<> <> DIRECTORY PrincOps USING[PsbIndex], Process USING[GetCurrent], Collector USING[InternalReclaim]; StorageAccounting: DEFINITIONS IMPORTS Process, Collector = BEGIN <<>> <> PSBIMap: TYPE = RECORD[elements: SEQUENCE maxLength: [0..LAST[PrincOps.PsbIndex]+1] OF CellCount]; CellCount: TYPE = RECORD[total, current: LONG INTEGER]; <> defaultCollectionInterval: LONG CARDINAL = 40000B; <> nWordsRequested: INT; nWordsAllocated: INT; SUMnWordsAllocated: INT; nWordsReclaimed: INT; nObjectsCreated: INT; nObjectsReclaimed: INT; MapPsbiToWordsAllocated: LONG POINTER TO PSBIMap; CollectionInterval: INT; SuspensionThreshold: INT; <> ResetNWordsAllocated: PROC; ResetTotalNWordsAllocatedOnly: PROC; ConsiderCollection: PROC[requestedWords, suppliedWords: LONG CARDINAL] = INLINE { psbi: PrincOps.PsbIndex = LOOPHOLE[Process.GetCurrent[]]; nw: LONG INTEGER _ MapPsbiToWordsAllocated.elements[psbi].current + suppliedWords; MapPsbiToWordsAllocated.elements[psbi].current _ nw; nWordsAllocated _ nWordsAllocated + suppliedWords; <> nWordsRequested _ nWordsRequested + requestedWords; -- total count for all processes IF LOOPHOLE[nWordsAllocated, INT] >= CollectionInterval THEN Collector.InternalReclaim[allocationInterval, nw > SuspensionThreshold]; }; END.