Garbage collection using a finite liveness domain
Open Access
- 16 June 2020
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 1-15
Abstract
Functional languages manage heap data through garbage collection. Since static analysis of heap data is difficult, garbage collectors conservatively approximate the liveness of heap objects by reachability i.e. every object that is reachable from the root set is considered live. Consequently, a large amount of memory that is reachable but not used further during execution is left uncollected by the collector. Earlier attempts at liveness-based garbage collection for languages supporting structured types were based on analyses that considered arbitrary liveness values, i.e. they assumed that any substructure of the data could be potentially live. This made the analyses complex and unscalable. However, functional programs traverse structured data like lists in identifiable patterns. We identify a set of eight usage patterns that we use as liveness values. The liveness analysis that accompanies our garbage collector is based on this set; liveness arising out of other patterns of traversal are conservatively approximated by this set. This restriction to a small set of liveness values reaps several benefits -- it results in a simple liveness analysis which scales to much larger programs with minimal loss of precision, enables the use of a faster collection technique, and is extendable to higher-order programs. Our experiments with a purely functional subset of Scheme show a reduction in the analysis time by orders of magnitude. In addition, the minimum heap size required to run programs is comparable with a liveness-based collector with unrestricted liveness values, and in situations where memory is limited, the garbage collection time is lower than its reachability counterpart.Keywords
This publication has 16 references indexed in Scilit:
- Liveness-Based Garbage CollectionLecture Notes in Computer Science, 2014
- Heap reference analysis using access graphsACM Transactions on Programming Languages and Systems, 2007
- Free-Me2006
- On the usefulness of type and liveness accuracy for garbage collection and leak detectionACM Transactions on Programming Languages and Systems, 2002
- A Type System for Bounded Space and Functional In-Place Update—Extended AbstractLecture Notes in Computer Science, 2000
- Typer inference builds a short cut to deforestation1999
- A region inference algorithmACM Transactions on Programming Languages and Systems, 1998
- Garbage collection and local variable type-precision and liveness in Java virtual machines1998
- SSA is functional programmingACM SIGPLAN Notices, 1998
- Analysis of functional programs to detect run-time garbage cellsACM Transactions on Programming Languages and Systems, 1988