2 Customizing the Lisp Environment

2.7 Dynamic garbage collection and memory management

On a virtual memory machine, one of the effects of dynamic garbage collection is compacting memory to prevent excessive paging. If your heap is large and you rarely reclaim storage, fragmentation can occur if your program conses for a long time, and paging activity will increase. A dynamic garbage collection could compact accessible objects onto fewer pages, which might fit entirely in physical memory.

You can use the following strategy to determine the best heap configuration for a given problem: expand dynamic space so that it fits in the available physical memory along with the other memory your program usually needs when running. For example, assume that your program has 1 megabyte of code that does not require much stack space or use large facilities like the Window Tool Kit. After doing some rough calculations, you determine that your program actively uses about 2 megabytes of Lisp system code and internal constructs, such as buffers and the stack, and that the operating system requires about 1 megabyte. Thus, the total memory required is 4 megabytes. If you make the semi-spaces 4 megabytes each, paging will occur mostly during dynamic garbage collection. If you have more physical memory, such as 16 megabytes, you might prevent paging during dynamic garbage collection by including both semi-spaces in physical memory.

If this strategy does not work, run the application and experiment with different heap sizes until you get optimum behavior.


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker