next up previous contents index
Next: Wiping divisions Up: ZEBRA - An Previous: Physical Storage

Dropping banks and garbage collection

Initially a dynamic store is empty, except for a few system banks in the system division. As banks are created the occupied space increases and the free space decreases. By calling MZDROP the user may drop banks, which are not needed any longer. MZDROP logically removes banks, or whole sub-structures, from the surrounding data structure and marks the banks as dropped. These dropped banks stay intact in memory and in particular, reference links pointing to dropped banks continue to point to valid information.

Possibly, but not normally, the situation can arise, that the free space is not sufficient to satisfy a request for creating a bank, in which case ZEBRA will recuperate the space occupied by the dropped banks. This operation, called garbage collection, moves the active banks of a division to form one contiguous area, squeezing out the dropped banks and thereby increasing again the free space, updating all links for the new positions of the banks in memory, including a reset to zero of reference links which used to point to the dropped banks which have now disappeared. The process of changing the links for the new position in memory is called relocation.

ZEBRA triggers a garbage collection automatically whenever a request for memory cannot be satisfied. If even after garbage collection there is not enough space, MZBOOK etc. will take an error exit and thus the user does not have to test, after each call to MZBOOK etc., for the successful completion of the request.

For garbage collection the ZEBRA system has to know the whereabouts of all the links in the program. For this reason it is essential that the user ke.gif all bank addresses in locations known to ZEBRA, either in the link part of banks, or in the link part of the working space or in link areas. Any link kept elsewhere will be invalid after a garbage collection.

The memory move involved in a garbage collection is represented in Figure gif.

The layout of memory in a division before and after garbage collection.
The top part of the picture shows a number of ``live'' banks numbered 1 to 7 and 5' to 1', which interspersed ``dead'' banks (i.e. banks whose information is no longer needed and whose space can hence be recovered). The bottom part of the picture shows the same ``live'' banks which have been left justified to increase the free space.  



next up previous contents index
Next: Wiping divisions Up: ZEBRA - An Previous: Physical Storage


Janne Saarela
Mon May 15 08:34:47 METDST 1995