(* Copyright (C) 1992, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* Last modified on Mon Dec 14 09:25:55 PST 1992 by jdd *) INTERFACE RTHeapPolicy; (* This interface provides access to parameters that tune the the garbage collector. These may be set by the client at any point. *) (* On the average, for every page allocated by the mutator, the collector will copy "gcRatio" pages. Increase the ratio to keep the heap smaller; decrease it to spend less time in the collector. *) VAR gcRatio := 1.0; (* collector work / mutator work *) (* The collector can be incremental or stop-and-copy. Incremental collection has much smaller interruptions of service, but takes more total time and more space. Assume there are "A" pages of accessible objects. If incremental is FALSE, the heap must contain up to A * (2 + 1 / gcRatio) pages. If incremental is TRUE, the heap must contain up to A * (2 + 2 / gcRatio) pages. In other words, to keep the same space bounds, gcRatio must be twice as large in the incremental case. Use incremental collection when the program is interactive. Stop-and-copy collection gives better performance. *) VAR incremental := TRUE; (* incremental collection *) (* There is also an optional "background" mode, which extends incremental mode with a background thread that moves collection ahead in the absence of program activity. The background thread is tuned to cause insignificant interruption of other activities, but therefore moves the collection forward quite slowly. *) PROCEDURE StartBackgroundCollection (); (* start the background thread, if not already started *) (* Generational collection causes most collections to take much less time than specified above, while using only a little more memory. Generational collection has the greatest benefit when the program has a large number of accessible objects, but most new objects are discarded shortly after they are allocated. *) VAR generational := TRUE; (* generational collection *) END RTHeapPolicy.