Teaching Garbage Collection without Implementing Compilers or Interpreters

Gregory H. Cooper, Arjun Guha, Shriram Krishnamurthi, Jay McCarthy, and Robert Bruce Findler
ACM Technical Symposium on Computer Science Education (SIGCSE), 2013

Given the widespread use of memory-safe languages, students must understand garbage collection well. Following a constructivist philosophy, an effective approach would be to have them implement garbage collectors. Unfortunately, a full implementation depends on substantial knowledge of compilers and runtime systems, which many courses do not cover or cannot assume.

This paper presents an instructive approach to teaching GC, where students implement it atop a simplified stack and heap. Our approach eliminates enormous curricular dependencies while preserving the essence of GC algorithms. We take pains to enable testability, comprehensibility, and facilitates debugging. Our approach has been successfully classroom-tested for several years at several institutions.

We have a blog post that summarizes this paper: Essentials of Garbage Collection.

PDF Slides

@inproceedings{cooper:teachinggc,
    author = "Gregory~H. Cooper and Arjun Guha and Shriram Krishnamurthi and
              Jay McCarthy and Robert~Bruce Findler",
    title = "Teaching Garbage Collection without Implementing Compilers or
             Interpreters",
    year = 2013,
    booktitle = "ACM Technical Symposium on Computer Science
                 Education (SIGCSE)"
  }