Allocating Memory from the Heap

To allocate a specified number of bytes from available memory, call the get memory function, mem_get():

PTR mem_get(size)

UINT size;        /* Number of bytes of memory to allocate             */

This function calls the standard compiler library function calloc() to allocate the specified number of bytes from the heap. The allocated bytes are set to 0's. A pointer to the allocated memory is returned. If there is insufficient memory, a NULLP is returned and the global error code is set.

Warning: Vermont Views functions depend on initializing the allocated bytes to 0's. If you replace our version of mem_get() with a memory allocation function of your own, you should initialize each byte to 0 (zero) when it is allocated.


Home Contents Previous Next