1 #include <../../nrnconf.h> 5 #if HAVE_POSIX_MEMALIGN 6 #define HAVE_MEMALIGN 1 13 #define _XOPEN_SOURCE 600 32 #include "nrnmpiuse.h" 34 #if defined(__APPLE__) && defined(__MACH__) 35 #include <mach/mach.h> 64 if (strcmp(sp->
name, s) == 0) {
100 sp->
name = (
char *)
emalloc((
unsigned)(strlen(s)+1));
111 (*list)->first = (*list)->last = (
Symbol *)0;
134 sp->
u.
pnum = (
double *)0;
154 if (list->
first == s) {
156 if (list->
last == s) {
167 if (list->
last == s) {
229 static int memalign_is_working = 1;
230 if (memalign_is_working) {
231 if (posix_memalign(memptr, 64, size) != 0) {
232 fprintf(stderr,
"posix_memalign not working, falling back to using malloc\n");
233 memalign_is_working = 0;
246 memset(*memptr, 0, nmemb*size);
259 p = realloc(ptr, size);
267 extern "C" void*
erealloc(
void* ptr,
size_t size) {
284 free((
char *)(s1->
u.
pnum));
309 hoc_warning(
"didn't free all objects created with the old template:", s1->
name);
325 free((
char *)
OPOBJ(s1));
334 Fprintf(stderr,
"In free_symspace may not free all of %s of type=%d\n", s1->
name, s1->
type);
364 for (s1 = (*list)->first; s1; s1 = s2){
372 free((
char *)(*list));
407 #if defined(__APPLE__) && defined(__MACH__) 412 struct mach_task_basic_info info;
413 mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
414 if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
415 (task_info_t)&info, &infoCount ) != KERN_SUCCESS )
417 return (
size_t)info.resident_size;
425 }
else if (item == 2) {
427 }
else if (item == 3) {
429 }
else if (item == 4) {
431 }
else if (item == 5) {
433 }
else if (item == 6) {
434 r = m.hblkhd + m.arena;
436 r = m.hblkhd + m.uordblks;
438 return (
unsigned long long)r;
447 unsigned long long x;
448 extern double chkarg(
int,
double,
double);
void print_symlist(const char *s, Symlist *tab)
void hoc_link_symbol(Symbol *sp, Symlist *list)
void * hoc_Emalloc(size_t n)
void notify_freed_val_array(double *p, size_t size)
void * erealloc(void *ptr, size_t size)
void hoc_free_string(char *p)
void hoc_l_freelist(hoc_List **)
void hoc_free_val_array(double *p, size_t size)
static philox4x32_key_t k
Symbol * hoc_install(const char *, int, double, Symlist **)
Symbol * install(char *s, int t)
unsigned long long nrn_mallinfo(int item)
Objectdata * hoc_top_level_data
int const size_t const size_t n
void hoc_obj_unref(Object *obj)
void notify_freed(void *p)
void hoc_free_object(Object *p)
void hoc_free_allobjects(cTemplate *ctemplate, Symlist *sl, Objectdata *data)
Symlist * hoc_top_level_symlist
Neuron/Java Interface code.
void hoc_warning(const char *, const char *)
void hoc_dec_refcount(Object **pobj)
fprintf(stderr, "Don't know the location of params at %p\, pp)
HocStruct Object * object_
void free_list(Symlist **list)
void notify_pointer_freed(void *pt)
void free_arrayinfo(Arrayinfo *a)
Symbol * hoc_table_lookup(const char *s, Symlist *tab)
void hoc_unlink_symbol(Symbol *s, Symlist *list)
void * ecalloc(size_t n, size_t size)
void hoc_install_object_data_index(Symbol *sp)
short cpublic
Note: public is a reserved keyword.
void * nrn_cacheline_calloc(void **memptr, size_t nmemb, size_t size)
HocStruct cTemplate * ctemplate
void sym_extra_alloc(Symbol *sym)
void hoc_free_pstring(char **p)
void * hoc_Ecalloc(size_t n, size_t size)
Symbol * hoc_install_var(const char *name, double *pval)
void hoc_free_symspace(Symbol *s1)
void * nrn_cacheline_alloc(void **memptr, size_t size)
double chkarg(int, double low, double high)
void hoc_free_val(double *p)
Symlist * hoc_built_in_symlist
void * hoc_Erealloc(void *ptr, size_t size)