Allocate:
PROCEDURE [words:
INT, partition:
VM.VMPartition ← normalVM, subRange:
VM.Interval ← [0, 0], start:
VM.PageNumber ← 0, alignment:
VM.LogPageCount ← 0, in64K:
BOOL ←
FALSE]
RETURNS [Handle];
Allocates the requested number of words of virtual memory, rounded up to a whole number of pages (the other arguments are passed unchanged to VM.Allocate and should ordinarily be defaulted). Returns a Handle designating the VM that was allocated. The client is responsible for holding onto the Handle for at least as long as it wants to be able to use the VM. The best way to reclaim the VM is to drop all copies of the handle and invoke the garbage collector.
Exceptions: raises VM.CantAllocate under the conditions described in the VM interface.
Pointer:
UNSAFE
PROCEDURE [handle: Handle]
RETURNS [
LONG
POINTER]
~ UNCHECKED INLINE {RETURN [VM.AddressForPageNumber[handle.interval.page]]};
Returns a pointer to the first word of the allocated storage. The client is responsible for making sure the resulting pointer is not used after the handle is dropped.
Words:
PROCEDURE [handle: Handle]
RETURNS [
INT]
~ INLINE {RETURN [handle.interval.count*PrincOps.wordsPerPage]};
Returns the number of words allocated.