next up previous
Next: H. RECURSION AND THE Up: LISP 1.5 Programmer's Manual Previous: F. LISP INPUT AND

G. MEMORY ALLOCATION AND THE GARBAGE COLLECTOR

The following diagram shows the way in which space is allocated 
in the LISP System.

77777 Loader 
77600 LAP 
70000 Compiler 
        Free Storage 
        Full Words 
        Push-Down List 
        Binary Program Space 
17000 Interpreter, I/O, Read Print, Arithmetic, Overlord, 
        Garbage Collector, and other system coding 
00000

The addresses in this chart are only approximate. The available 
space is divided among binary program space, push-down list, 
full-word space, and free-storage space as specified on the SIZE 
card when the system is made.

When the compiler and LAP are not to be used again, they may be 
eliminated by executing the pseudo-function excise. This part of 
the memory is then converted into free storage.

Free storage is the area in the computer where list structures 
are stored. This includes the property lists of atomic symbols, 
the definitions of all EXPR's and FEXPR's, evalquote doublets 
waiting to be executed, APVAL's, and partial results of the 
computation that is in progress.

Full-word space is filled with the BCD characters of PNAME's, the 
actual numbers of numerical atomic structures, and the TXL words 
of SUBR's, FSUBR's, and SYM's.

All available words in the free-storage area that are not in use 
are strung together in one long list called the free-storage 
list. Every time a word is needed (for example, by cons) the 
first word on the free-storage list is used, and the free-storage 
list is set to cdr of what it formerly was.

Full-word space is handled in the same way. No use is made of 
consecutive storage in either of these areas of memory. They are 
both scrambled.

When either of these lists is exhausted in the middle of a 
computation, the garbage collector is called automatically. 
Unless the computation is too large for the system, there are 
many words in free storage and full-word space that are no longer 
needed. The garbage collector locates these by marking those 
words that are needed. In free storage, the sign bit is used for 
marking. In full-word space, there is no room in the word itself. 
Marking is done in a bit table which is next to full-word space.

Since it is important that all needed lists be marked, the 
garbage collector starts marking from several base positions 
including the following:

1. The object list that includes all atomic symbols except 
numbers and generated names. This protects the atomic symbols, 
and all S-expressions that hang on the property lists of atomic 
symbols.

2. The portion of the push-down list that is currently being 
used. This protects partial results of the computation that is 
in progress.

3. The temlis, which is a list of registers scattered throughout 
the memory where binary programs store list structures that must 
be protected.

Marking proceeds as follows. If the cell is in full-word space, 
then the bit table is marked. If the cell is in free storage, 
then the sign is set minus, and car and cdr of the cell 
are marked. If the cell is anywhere else, then nothing is done.

After the marking is done, the new available word lists are made 
by stringing all unmarked words together. Finally, the signs in 
free storage are set plus.

A garbage collection takes approximately 1 second on the IBM 7090 
computer. It can be recognized by the stationary pattern of the 
MQ lights. Any trap that prevents completion of a garbage 
collection will create a panic condition in memory from which 
there is no recovery.


next up previous
Next: H. RECURSION AND THE Up: LISP 1.5 Programmer's Manual Previous: F. LISP INPUT AND