RTAllocator provides access to the runtime storage allocator.
\index{allocator}
\index{storage allocator}
\index{heap}
INTERFACEEach of the procedures described below allocates and initializes heap storage. Calling any of these procedures with a typecodeRTAllocator ; FROM RTType IMPORT Typecode;
tc that
names a type T is equivalent to calling NEW for that type. It is a
checked runtime error to pass a typecode that is not proper. (See
RTType for the definition of proper typecode.)
PROCEDURE NewTraced(tc: Typecode): REFANY
RAISES {OutOfMemory};
Return a reference to a freshly allocated and initialized, traced referent with typecodetc. It is a checked runtime error iftcdoes not name a traced reference type other thanREFANY, or if its referent is an open array.
PROCEDURE NewUntraced(tc: Typecode): ADDRESS
RAISES {OutOfMemory};
Return a reference to a freshly allocated and initialized, untraced referent with typecodetc. It is a checked runtime error iftcdoes not name an untraced reference type other thanADDRESS, or if it names an untraced object type, or if its referent is an open array.
PROCEDURE NewUntracedObject(tc: Typecode): UNTRACED ROOT
RAISES {OutOfMemory};
Return a freshly allocated and initialized, untraced object with typecodetc. It is a checked runtime error iftcdoes not name an untraced object type.
TYPE Shape = ARRAY OF INTEGER;
PROCEDURE NewTracedArray(tc: Typecode; READONLY s: Shape): REFANY
RAISES {OutOfMemory};
Return a reference to a freshly allocated and initialized, traced open array referent with typecodetcand sizess[0], ...,s[LAST(s)]. It is a checked runtime error iftcdoes not name a traced reference to an open array, or if anys[i]is negative, or ifNUMBER(s)does not equal the number of open dimensions of the array.
PROCEDURE NewUntracedArray(tc: Typecode; READONLY s: Shape): ADDRESS
RAISES {OutOfMemory};
Return a reference to a freshly allocated and initialized, untraced open array referent with typecodetcand sizess[0], ...,s[LAST(s)]. It is a checked runtime error iftcdoes not name an untraced reference to an open array, or if anys[i]is negative, or ifNUMBER(s)does not equal the number of open dimensions of the array.
PROCEDURE Clone (ref: REFANY): REFANY
RAISES {OutOfMemory};
Return a reference to a freshly allocated and initialized, traced reference, object or array. The new referent will have the same runtime type asrefand a copy of its contents,ref^.
EXCEPTION OutOfMemory;
Raised if the allocator was unable to allocate the requested object
--------------------------------------------------------- SRC only ---
VAR callback: PROCEDURE (ref: REFANY) := NIL;
If non-NIL, the allocator callscallback(r)just before returning a new traced referencer. SeeRTAllocStatsfor an example client.
END RTAllocator.