Memory management functions.
More...
Detailed Description
Memory management functions.
Define Documentation
Function Documentation
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().
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().
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.
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.
| void operator delete |
( |
void * |
ptr | ) |
throw () |
| void operator delete[] |
( |
void * |
ptr | ) |
throw () |
| void* operator new |
( |
size_t |
nbytes | ) |
|
| void* operator new[] |
( |
size_t |
nbytes | ) |
|