Supported RPG Features

The %ALLOC(size) built-in function allocates size bytes of heap storage and returns a pointer to it. This is the free-format expression equivalent of the fixed-format ALLOC opcode:

ptr = %ALLOC(100);        // allocate 100 bytes
ptr = %REALLOC(ptr:200);  // resize to 200 bytes, preserving contents
DEALLOC ptr;              // free the storage

%REALLOC(pointer:newSize) resizes an existing allocation, preserving contents up to the smaller of the old and new sizes. Both return a pointer suitable for use with BASED variables.