Optimal Choice of When to Garbage Collect
Open Access
- 4 January 2019
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Programming Languages and Systems
- Vol. 41 (1) , 1-35
Abstract
We consider the ultimate limits of program-specific garbage collector (GC) performance for real programs. We first characterize the GC schedule optimization problem. Based on this characterization, we develop a linear-time dynamic programming solution that, given a program run and heap size, computes an optimal schedule of collections for a non-generational collector. Using an analysis of a heap object graph of the program, we compute a property of heap objects that we call their pre-birth time. This information enables us to extend the non-generational GC schedule problem to the generational GC case in a way that also admits a dynamic programming solution with cost quadratic in the length of the trace (number of objects allocated). This improves our previously reported approximately optimal result. We further extend the two-generation dynamic program to any number of generations, allowing other generalizations as well. Our experimental results for two generations on traces from Java programs of the DaCapo benchmark suite show that there is considerable promise to reduce garbage collection costs for some programs by developing program-specific collection policies. For a given space budget, optimal schedules often obtain modest but useful time savings, and for a given time budget, optimal schedules can obtain considerable space savings.Keywords
Funding Information
- National Science Foundation (CCF-1320498)
This publication has 7 references indexed in Scilit:
- Space overhead bounds for dynamic memory management with partial compactionACM Transactions on Programming Languages and Systems, 2012
- Wake up and smell the coffeeCommunications of the ACM, 2008
- Generating object lifetime traces with MerlinACM Transactions on Programming Languages and Systems, 2006
- The space cost of lazy reference counting2004
- Storage allocation is NP-hardInformation Processing Letters, 1980
- Bounds for Some Functions Concerning Dynamic Storage AllocationJournal of the ACM, 1974
- An Estimate of the Store Size Necessary for Dynamic Storage AllocationJournal of the ACM, 1971