NEW - Allocate typed variable

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

NEW(identifier)

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


<identifier> is any typed pointer variable.


The size of the allocated memory block depends of the size of the type pointed by <identifier>.

If the 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 DISPOSE or FREEMEM standard built-in procedures.


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


See also: DISPOSE, PMP dynamic memory allocation.