The MALLOC macro is a platform-independent substitute for the C library routine malloc. It allocates size bytes from the requests's memory pool. The memory can be explicitly freed by a call to FREE. If the memory is not explicitly freed, it is automatically freed after processing of the current request has been completed. If pooled memory has been disabled in the configuration file (with the pool-initbuilt-in SAF), PERM_MALLOC and MALLOC both obtain their memory from the system heap. However, since memory allocated by MALLOC is automatically freed, it should not be shared between threads.
If pooled memory has been disabled in the configuration file (with the pool-init built-in SAF), PERM_MALLOC and MALLOC both obtain their memory from the system heap.
void *MALLOC(int size)
A void pointer to a block of memory.
int size is the number of bytes to allocate.
/* Allocate 256 bytes for a name */ char *name; name = (char *) MALLOC(256);