SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
memory.cpp File Reference

Go to the source code of this file.

Macros

#define SG_SPECIALIZED_MALLOC(type)

Functions

void * operator new (size_t size) throw (std::bad_alloc)
void operator delete (void *p) throw ()
void * operator new[] (size_t size) throw (std::bad_alloc)
void operator delete[] (void *p) throw ()
void * sg_malloc (size_t size)
void * sg_calloc (size_t num, size_t size)
void sg_free (void *ptr)
void * sg_realloc (void *ptr, size_t size)

Macro Definition Documentation

#define SG_SPECIALIZED_MALLOC (   type)
Value:
template<> type* sg_generic_malloc<type >(size_t len) \
{ \
return new type[len](); \
} \
\
template<> type* sg_generic_calloc<type >(size_t len) \
{ \
return new type[len](); \
} \
\
template<> type* sg_generic_realloc<type >(type* ptr, size_t old_len, size_t len) \
{ \
type* new_ptr = new type[len](); \
size_t min_len=old_len; \
if (len<min_len) \
min_len=len; \
for (size_t i=0; i<min_len; i++) \
new_ptr[i]=ptr[i]; \
delete[] ptr; \
return new_ptr; \
} \
\
template<> void sg_generic_free<type >(type* ptr) \
{ \
delete[] ptr; \
}

Definition at line 368 of file memory.cpp.

Function Documentation

void operator delete ( void *  p) throw ()

Definition at line 126 of file memory.cpp.

void operator delete[] ( void *  p) throw ()

Definition at line 176 of file memory.cpp.

void* operator new ( size_t  size) throw (std::bad_alloc)

Definition at line 96 of file memory.cpp.

void* operator new[] ( size_t  size) throw (std::bad_alloc)

Definition at line 145 of file memory.cpp.


SHOGUN Machine Learning Toolbox - Documentation