Macaulay2 Engine
Loading...
Searching...
No Matches

◆ getmem_clear()

char * getmem_clear ( size_t n)

Definition at line 112 of file m2-mem.cpp.

113{
114 char *p;
115 enter_getmem();
116#ifdef MEMDEBUG
117 p = M2_debug_malloc(n);
118#else
119 p = reinterpret_cast<char*>(GC_MALLOC(n));
120#endif
121 if (p == NULL) outofmem2(n);
122#ifdef MEMDEBUG
123 memset(p,0,n);
124#else
125 /* note: GC_MALLOC clears memory before returning.
126 If you switch to another memory allocator, you must clear it explicitly here */
127#endif
128 #ifndef NDEBUG
129 trapchk(p);
130 #endif
131 exit_getmem();
132 return p;
133}
int p
void trapchk(void *p)
Definition m2-mem.cpp:40
static void exit_getmem()
Definition m2-mem.cpp:22
static void enter_getmem()
Definition m2-mem.cpp:15
void outofmem2(size_t newsize)
Definition m2-mem.cpp:64

References enter_getmem(), exit_getmem(), outofmem2(), p, and trapchk().