Memory Management

The following functions manipulate memory and its allocation/deallocation:

#REGISTER

Control automatic allocation of Register variables.

#STACK

Set the maximum potential stack size.

ASMDATA/END ASMDATA

Define a block where primitive read-only data is stored.

CODEPTR

Obtain a 32-bit address of a label, Sub or Function.

DIM

Declare and dimension arrays, scalar variables, and pointers.

ERASE

Deallocate array memory.

GLOBAL

Declare global (shared) variables between Subs, Functions, Methods, and Properties.

GLOBALMEM ALLOC

Allocate a moveable memory block of a specified size.

GLOBALMEM FREE

Deallocate a moveable memory block.

GLOBALMEM LOCK

Lock a moveable memory block at a specific memory location.

GLOBALMEM SIZE

Retrieve the size of a moveable memory block.

GLOBALMEM UNLOCK

Unlock a moveable memory block.

INSTANCE

Declare INSTANCE variables which are unique to each object.

LEN

Return the logical length of a variable, UDT, or Union.

LET

Assign a value to a variable.

LET (with Objects)

Assign an object reference to an object variable.

LET (with Types)

Assign data to a user-defined type variable.

LET (with Variants)

Assign a value or an object reference to a variant variable.

LOCAL

Declare local variables in a Sub, Function, Method, or Property.

MEMORY COPY

Copy a specified number of bytes from one address to another.

MEMORY FILL

Fill memory with a specified BYTE, WORD, DWORD, or bytes from a string expression.

MEMORY SWAP

Memory at the address specified is exchanged with the data at another address.

PEEK

Return the byte at a specific memory location.

PEEK$

Returns consecutive 1-byte characters starting at a specific memory location.

PEEK$$

Returns consecutive 2-byte wide characters starting at a specific memory location.

POKE

Store a byte at a specific memory location.

POKE$

Store a sequence of bytes starting at a specific memory location.

POKE$$

Store a sequence as 2-byte wide characters starting at a specific memory location.

REDIM

Declare dynamic arrays, allocate, reallocate, deallocate memory.

REGISTER

Define local Register variables within a Sub, Function, Method, or Property.

RESET

Set an array subscript or an entire array to zero or null/empty.

SIZEOF

Return the total or physical length of any PowerBASIC variable.

STATIC

Declare static variables inside of a Sub, Function, Method, or Property.

STRPTR

Return the address of the data held by a variable length string.

THREADED         

Declare thread-local variables.

TYPE/END TYPE

Define a User-Defined Type and one or more member elements.

TYPE SET

Assign the value of a UDT or string expression to a UDT.

UNION/END UNION

Create a UDT-like structure whose elements overlap in memory.

VARPTR

Return the 32-bit address of a variable or string handle.