Geant4 Cross Reference |
1 // see license file for original license. 2 3 #ifndef tools_glutess_memalloc 4 #define tools_glutess_memalloc 5 6 ////////////////////////////////////////////// 7 /// inlined C code : ///////////////////////// 8 ////////////////////////////////////////////// 9 10 #ifdef TOOLS_MEM 11 #include "../mem" 12 #include <cstdlib> 13 namespace tools { 14 inline void* mem_alloc(size_t a_size){ 15 mem::increment(tools::s_malloc().c_str()); 16 return ::malloc(a_size); 17 } 18 inline void* mem_realloc(void* a_ptr,size_t a_ 19 if(a_ptr==NULL) mem::increment(tools::s_mall 20 return ::realloc(a_ptr,a_size); 21 } 22 inline void mem_free(void* a_ptr){ 23 if(a_ptr!=NULL) mem::decrement(tools::s_mall 24 ::free(a_ptr); 25 } 26 inline int mem_init( size_t /*maxFast*/) {retu 27 28 } 29 #else 30 #include <cstdlib> 31 #include <cstring> 32 namespace tools { 33 inline void* mem_alloc(size_t a_size) {return 34 inline void* mem_realloc(void* a_ptr,size_t a_ 35 inline void mem_free(void* a_ptr){::free(a_ptr 36 inline int mem_init( size_t /*maxFast*/) {retu 37 } 38 #endif 39 40 #define memAlloc tools::mem_alloc 41 #define memRealloc tools::mem_realloc 42 #define memFree tools::mem_free 43 #define memInit tools::mem_init 44 45 #endif