A malloc implementation without free for boards where the toolchain does not implement dynamic memory allocation. More...
A malloc implementation without free for boards where the toolchain does not implement dynamic memory allocation.
The toolchain of MSP-430, for example, does not contain malloc() and friends. These functions provide the same interface as the stdlib functions, but the option to free memory.
Files | |
file | malloc.h |
Functions | |
void * | malloc (size_t size) |
Allocation a block of memory. | |
void * | realloc (void *ptr, size_t size) |
Allocated a new block of memory and move the existing content. | |
void * | calloc (size_t size, size_t cnt) |
Allocate a memory block and set all its content to zeroes. | |
void | free (void *ptr) |
This is a no-op. | |
void * calloc | ( | size_t | size, |
size_t | cnt | ||
) |
Allocate a memory block and set all its content to zeroes.
Please see malloc() for more information.
[in] | size | One factor of the number of bytes to allocated. |
[in] | cnt | The other factor of the number of bytes to allocated. |
NULL
if the "heap" is exhausted. void free | ( | void * | ptr | ) |
This is a no-op.
You read correctly: This function does noting.
[in] | ptr | The ignored argument. |
void * malloc | ( | size_t | size | ) |
Allocation a block of memory.
[in] | size | Size of the block to allocate in bytes. |
NULL
if the "heap" is exhausted. void * realloc | ( | void * | ptr, |
size_t | size | ||
) |
Allocated a new block of memory and move the existing content.
This function allocates a new block of memory and memcpy()s the content of the one ptr
there.
We do not know the size of the old block, so illegal reads would be likely, if it was not for the fact that the memory heap up.
[in] | ptr | Old memory block that was allocated with malloc(), calloc() or realloc(). |
[in] | size | Size of the new block to allocated in bytes. |
NULL
if the "heap" is exhausted.