CSc 520 - Principles of Programming Languages
12 : Memory Management -- GC -- Discussion

Christian Collberg

Department of Computer Science

University of Arizona


Unobrusive Garbage Collection


1 Unobrusive Garbage Collection

GC Requirements:

batch programs:
We want short total GC time.
interactive programs:
We want unnoticable GCs.

Unobtrusive GC:

Incremental Collection
Concurrent Collection

2 Incremental GC

3 Incremental GC...

4 Incremental GC...

  1. Copy and update objects pointed to by global pointers to to-space.
  2. Resume program.
  3. When an object in from-space is referenced, first copy it to to-space.

  4. Every time NEW is called, pointers are forwarded.

5 Exam Problem

  1. Why is generational collection more appropriate for functional and logic languages (such as LISP and Prolog), than for object-oriented languages (such as Eiffel and Modula-3)?
  2. The heap in the figure on the next slide holds 7 objects. All objects have one integer field and one or two pointer fields (black dots). The only roots are the three global variables X, Y, and Z. Free space is shaded. Show the state of To-Space after a copying garbage collection has been performed on From-Space. Note that several answers are possible, depending on the visit strategy (Depth-First or Breadth-First Search) you chose.

6 Exam Problem I...

Exam1

7 Exam Problem...

  1. Name five garbage collection algorithms!
  2. Describe the Deutsch-Schorr-Waite algorithm! When is it used? Why is it used? How does it work?
  3. What are the differences between stop-and-copy, incremental and concurrent garbage collection? When would we prefer one over the other?

8 Readings and References

9 Readings and References...



Christian Collberg 2008-04-29