UnsafeStorage: DEFINITIONS
= BEGIN
NewUObject:
PROC[size:
CARDINAL
--words--, zone:
UNCOUNTED
ZONE]
RETURNS [
LONG
POINTER];
use this instead of uz.NEW if explicit control of the size arg is required
NewUZone: PROC[initialSize: INT ← 0--words--] RETURNS[UNCOUNTED ZONE];
FreeUZone:
PROC[uz:
UNCOUNTED
ZONE];
releases all storage associeated with the zone. Beware of dangling pointers!
ExtendUZone: UZoneFullProc;
UZoneFullProc: TYPE = PROC[zone: UNCOUNTED ZONE, size: INT--words--];
a uzone's fullProc is called when there is insufficient VM assigned to the uzone to satisfy a request (via NEW) to allocate an object of "size" words. After the fullProc returns another allocation attempt is made.
SetUZoneFullProc:
PROC[zone:
UNCOUNTED
ZONE, proc: UZoneFullProc]
RETURNS[oldProc: UZoneFullProc];
the default UZoneFullProc for a uzone is ExtendUZone
TrimUZone:
PROC[zone:
UNCOUNTED
ZONE];
returns free VM pages to the operating system
IsUZoneEmpty:
PROC[zone:
UNCOUNTED
ZONE]
RETURNS[
BOOL];
TRUE if no VM pages are assigned to it
GetSystemUZone:
PROC
RETURNS[
UNCOUNTED
ZONE];
Access to a pre-defined UNCOUNTED ZONE
SIGNALs and ERRORs
InvalidPointer: ERROR[ptr: LONG POINTER]; -- Raised by FREE
END.