 | CARM User's Guide Discontinued |  |
|
|
| free| Summary | | | Description | The free function returns a memory block to the memory pool. The p argument points to a memory block that was previously allocated with the calloc, malloc, or realloc functions. Once it has been returned to the memory pool by the free function, the block is available for subsequent allocation. If p is a null pointer, it is ignored. Note | | Return Value | None. | | See Also | calloc, init_mempool, malloc, realloc | | Example |
#include <stdlib.h>
#include <stdio.h> /* for printf */
void tst_free (void) {
unsigned char *mbuf;
printf ("Allocating memory\n");
mbuf = malloc (1000);
if (mbuf == 0) {
printf ("Unable to allocate memory\n");
}
else {
free (mbuf);
printf ("Memory free\n");
}
}
|
|
|