Go to the documentation of this file.
22 #ifdef TRACE_MEMORY_ALLOCS
23 #define SG_MALLOC(type, len) (type*) sg_malloc(sizeof(type)*size_t(len), __FILE__, __LINE__)
24 #define SG_MALLOC(type, len) (type*) sg_malloc(sizeof(type)*size_t(len), __FILE__, __LINE__)
25 #define SG_CALLOC(type, len) (type*) sg_calloc(size_t(len), sizeof(type), __FILE__, __LINE__)
26 #define SG_REALLOC(type, ptr, len) (type*) sg_realloc(ptr, sizeof(type)*size_t(len), __FILE__, __LINE__)
27 #define SG_FREE(ptr) sg_free(ptr)
29 void*
sg_malloc(
size_t size,
const char* file,
int line);
31 void*
sg_realloc(
void* ptr,
size_t size,
const char* file,
int line);
32 void*
sg_calloc(
size_t num,
size_t size,
const char* file,
int line);
33 #else //TRACE_MEMORY_ALLOCS
35 #define SG_MALLOC(type, len) (type*) sg_malloc(sizeof(type)*size_t(len))
36 #define SG_MALLOC(type, len) (type*) sg_malloc(sizeof(type)*size_t(len))
37 #define SG_CALLOC(type, len) (type*) sg_calloc(size_t(len), sizeof(type))
38 #define SG_REALLOC(type, ptr, len) (type*) sg_realloc(ptr, sizeof(type)*size_t(len))
39 #define SG_FREE(ptr) sg_free(ptr)
45 #endif //TRACE_MEMORY_ALLOCS
48 void*
operator new(
size_t size)
throw (std::bad_alloc);
49 void operator delete(
void *p)
throw();
52 void*
operator new[](
size_t size)
throw(std::bad_alloc);
53 void operator delete[](
void *p)
throw();
56 #ifdef TRACE_MEMORY_ALLOCS
76 MemoryBlock(
void* p,
size_t sz,
const char* fname=NULL,
int linenr=-1);
80 MemoryBlock(
const MemoryBlock &b);
85 bool operator==(
const MemoryBlock &b)
const;
100 void list_memory_allocs();
102 #endif // __MEMORY_H__
SHOGUN Machine Learning Toolbox - Documentation