GETMEM - Allocate untyped variable

Language reference ›› Built-in procedures ›› Dynamic memory management ››
Parent Previous Next

GETMEM(identifier, size)

Create a new dynamic variable and initializes a pointer variable to point on it.

<identifier> is any untyped or typed pointer variable.

<size> is the requested byte count.

If the heap of free memory does not have enough space to allocate the block, the ERROR procedure is called and the processor is halted.

The allocated memory should be freed by a call to the FREEMEM standard built-in procedure.

This procedure is implemented only for HIGHPERF (PIC18) and ENHANCED (PIC16'1xxx).

See also: FREEMEM, PMP dynamic memory allocation.