Memory
[Common]

Memory management functions. More...

Defines

#define THROW_BAD_ALLOC   throw(std::bad_alloc)

Functions

void * mem_alloc (size_t nbytes)
 allocate memory
void * mem_alloc_clear (size_t nbytes)
 allocate and clear memory
void * mem_change_size (void *, size_t)
void mem_free (void *)
char * mem_copy_string (const char *arg)
char * mem_copy_string (const char *arg, size_t len)
void * operator new (size_t nbytes) THROW_BAD_ALLOC
void * operator new[] (size_t nbytes) THROW_BAD_ALLOC
void operator delete (void *ptr) throw ()
void operator delete[] (void *ptr) throw ()
void * operator new (size_t nbytes, std::nothrow_t &) throw ()
void * operator new[] (size_t nbytes, std::nothrow_t &) throw ()
void operator delete (void *ptr, std::nothrow_t const &) throw ()
void operator delete[] (void *ptr, std::nothrow_t const &) throw ()

Detailed Description

Memory management functions.


Define Documentation

#define THROW_BAD_ALLOC   throw(std::bad_alloc)

Definition at line 128 of file mem.h.


Function Documentation

void* mem_alloc ( size_t  nbytes  ) 

allocate memory

mem_alloc uses malloc to allocate the required sized chunk of memory. If any error is returned from malloc() a fatal diagnostic is issued.

Parameters:
nbytes The size of the memory to allocate.
Warning:
It is the responsibility of the caller to ensure that the space is freed when finished with, by a call to mem_free().

void* mem_alloc_clear ( size_t  nbytes  ) 

allocate and clear memory

mem_alloc_clear uses malloc to allocate the required sized chunk of memory. If any error is returned from malloc() an fatal diagnostic is issued. The memory is zeroed befor it is returned.

Parameters:
nbytes The size of the memory to allocate
Warning:
It is the responsibility of the caller to ensure that the space is freed when finished with, by a call to free().

void* mem_change_size ( void *  ,
size_t   
)

char* mem_copy_string ( const char *  arg,
size_t  len 
)

The mem_copy_string function may be used to copy a string into dynamically allocated memory.

Parameters:
arg The string to be copied (it is *not* NUL terminated).
len The length of the string to be copied.
Returns:
A copy of the string in dynamic memory. The copy *is* NUL terminated. Use mem_free when you are done with it.

char* mem_copy_string ( const char *  arg  ) 

The mem_copy_string function may be used to copy a C string into dynamically allocated memory.

Parameters:
arg The NUL terminated string to be copied.
Returns:
A copy of the string in dynamic memory. Use mem_free when you are done with it.

void mem_free ( void *   ) 

void operator delete ( void *  ptr,
std::nothrow_t const &   
) throw ()

void operator delete ( void *  ptr  )  throw ()

void operator delete[] ( void *  ptr,
std::nothrow_t const &   
) throw ()

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

void* operator new ( size_t  nbytes,
std::nothrow_t &   
) throw ()

void* operator new ( size_t  nbytes  ) 

void* operator new[] ( size_t  nbytes,
std::nothrow_t &   
) throw ()

void* operator new[] ( size_t  nbytes  ) 


Generated on Wed Mar 12 23:37:38 2008 for Aegis by  doxygen 1.5.5