CollectibleVM.mesa
Last Edited by: Taft, October 18, 1983 10:28 am
DIRECTORY
VM USING [Interval, LogPageCount, PageCount, PageNumber, VMPartition];
CollectibleVM: CEDAR DEFINITIONS =
BEGIN
Handle: TYPE = REF Object;
Object: TYPE = RECORD [LONG DESCRIPTOR FOR ARRAY OF WORD];
New: PROCEDURE [count: VM.PageCount, partition: VM.VMPartition ← normalVM, subRange: VM.Interval ← [0, 0], start: VM.PageNumber ← 0, alignment: VM.LogPageCount ← 0, in64K: BOOLFALSE] RETURNS [h: Handle];
Allocates count pages of virtual memory (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 may subsequently obtain a LONG POINTER to the allocated memory by uttering h^.BASE, and its size in words by h^.LENGTH. The client is responsible for holding onto the Handle for at least as long as it wants to be able to use the VM.
Exceptions: raises VM.CantAllocate under the conditions described in the VM interface.
Free: PROCEDURE [h: Handle];
Deallocates the virtual memory associated with the Handle. The client asserts that it will no longer attempt to access the VM; and h^.BASE is set to NIL to discourage such access.
The VM will also be deallocated if the client ceases to hold onto the Handle and the Object is reclaimed by the garbage collector. Consequently, the client is not absolutely required to free allocated VM, but is encouraged to do so whenever convenient since garbage collection occurs infrequently.
Exceptions: none.
END.