Myths and Realities: The Performance Impact of Garbage Collection
Paper · 2004 · Stephen M. Blackburn, Perry Cheng and Kathryn S. McKinley
Summary
The paper asks how much garbage collection really costs in Java and whether common beliefs hold up under careful measurement. The authors implement the three classic collectors (semi-space copying, mark-sweep, reference counting) and their generational versions in MMTk, running inside IBM's Jikes RVM. Because the collectors share identical underlying mechanisms, the comparison isolates policy differences. They run the SPEC JVM benchmarks across many fixed heap sizes on Athlon, Pentium 4 and PowerPC machines. Hardware counters separate mutator time from collector time and record L1, L2 and TLB misses. The results show that bump-pointer (contiguous) allocation gives the application noticeably better locality than free-list allocation. Generational collectors with a copying nursery outperform whole-heap collectors in almost every setting, and they even beat running with no collection at all. The choice of mature-space policy matters much less. These findings give memory-management designers evidence-based guidance and correct several long-standing assumptions.
Key points
- Platform: MMTk in Jikes RVM. The study covers 6 collectors, 9 benchmarks and 3 architectures, with the same trends appearing on all three architectures.
- Among whole-heap collectors, mark-sweep is best in tight heaps because it needs fewer collections. As heaps grow, the locality gains from contiguous allocation let copying win, with fewer L1, L2 and TLB misses.
- The generational write barrier usually costs the mutator about 2% or less. Its worst observed cost of 14% is still outweighed by savings in collection time.
- Most locality benefits come from young objects, which motivates a copying nursery. The common advice to match nursery size to L2 cache size is shown to be a myth.
- Mature-space policy has a limited effect. A copying mature space helps when mature references are scattered and frequent, while a mark-sweep mature space wins in small heaps.
Fields, topics and concepts
Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksArtificial Intelligence · 18,805 worksHardware and Architecture · 183 worksComputer Networks and Communications · 115 works
Cite
Cite as Stephen M. Blackburn, Perry Cheng and Kathryn S. McKinley. 2004. Myths and Realities: The Performance Impact of Garbage Collection. SIGMETRICS 2004.
@inproceedings{blackburn2004myths,
title = {{Myths and Realities: The Performance Impact of Garbage Collection}},
author = {Stephen M. Blackburn, Perry Cheng and Kathryn S. McKinley},
booktitle = {SIGMETRICS 2004},
year = {2004},
url = {https://www.steveblackburn.org/pubs/papers/mmtk-sigmetrics-2004.pdf}
}References
- B. Alpern et al. Implementing Jalapeño in Java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 314–324, Denver, CO, Nov. 1999. OpenAlex ↗ · Scholar ↗
- B. Alpern et al. The Jalapeño virtual machine. IBM Systems Journal, 39(1):211–238, February 2000. OpenAlex ↗ · Scholar ↗
- A. W. Appel. Simple generational garbage collection and fast allocation. Software Practice and Experience, 19(2):171–183, 1989. OpenAlex ↗ · Scholar ↗
- M. Arnold, S. J. Fink, D. Grove, M. Hind, and P. Sweeney. Adaptive optimization in the Jalapeño JVM. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 47–65, Minneapolis, MN, October 2000. OpenAlex ↗ · Scholar ↗
- C. R. Attanasio, D. F. Bacon, A. Cocchi, and S. Smith. A comparative evaluation of parallel garbage collectors. In Languages and Compilers for Parallel Computing, Lecture Notes in Computer Science. Springer-Verlag, 2001. OpenAlex ↗ · Scholar ↗
- D. Bacon, S. Fink, and D. Grove. Space- and time-efficient implementations of the Java object model. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP), pages 111–132. ACM Press, June 2002. OpenAlex ↗ · Scholar ↗
- D. F. Bacon and V. T. Rajan. Concurrent cycle collection in reference counted systems. In J. L. Knudsen, editor, Proc. of the 15th ECOOP, volume 2072 of Lecture Notes in Computer Science, pages 207–235. Springer-Verlag, 2001. OpenAlex ↗ · Scholar ↗
- H. G. Baker. The Treadmill: Real-time garbage collection without motion sickness. ACM SIGPLAN Notices, 27(3):66–70, 1992. OpenAlex ↗ · Scholar ↗
- E. D. Berger, K. S. McKinley, R. D. Blumofe, and P. R. Wilson. Hoard: A scalable memory allocator for multithreaded applications. In ACM Conference on Architectural Support for Programming Languages and Operating Systems, Cambridge, MA, Nov. 2000. OpenAlex ↗ · Scholar ↗
- E. D. Berger, B. G. Zorn, and K. S. McKinley. Composing high-performance memory allocators. In ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 114–124, Salt Lake City, UT, June 2001. OpenAlex ↗ · Scholar ↗
- E. D. Berger, B. G. Zorn, and K. S. McKinley. Reconsidering custom memory allocation. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 1–12, Seattle, WA, Nov. 2002. OpenAlex ↗ · Scholar ↗
- S. M. Blackburn, P. Cheng, and K. S. McKinley. Myths and realities: The performance impact of garbage collection. Technical Report TR-CS-04-04, Dept. of Computer Science, Australian National University, 2004. OpenAlex ↗ · Scholar ↗
- S. M. Blackburn, P. Cheng, and K. S. McKinley. Oil and water? High performance garbage collection in Java with JMTk. In ICSE, Scotland, UK, May 2004. OpenAlex ↗ · Scholar ↗
- S. M. Blackburn, R. E. Jones, K. S. McKinley, and J. E. B. Moss. Beltway: Getting around garbage collection gridlock. In Proc. of SIGPLAN 2002 Conference on PLDI, pages 153–164, Berlin, Germany, June 2002. OpenAlex ↗ · Scholar ↗
- S. M. Blackburn and K. S. McKinley. In or out? Putting write barriers in their place. In ACM International Symposium on Memory Management, pages 175–183, Berlin, Germany, June 2002. OpenAlex ↗ · Scholar ↗
- S. M. Blackburn and K. S. McKinley. Ulterior reference counting: Fast garbage collection without a long wait. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 244–358, Anaheim, CA, Oct. 2003. OpenAlex ↗ · Scholar ↗
- H.-J. Boehm. Space efficient conservative garbage collection. In ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 197–206, 1993. OpenAlex ↗ · Scholar ↗
- T. Brecht, E. Arjomandi, C. Li, and H. Pham. Controlling garbage collection and heap growth to reduce the execution time of Java applications. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 353–366, Tampa, FL, 2001. OpenAlex ↗ · Scholar ↗
- C. J. Cheney. A non-recursive list compacting algorithm. Communications of the ACM, 13(11):677–8, Nov. 1970. OpenAlex ↗ · Scholar ↗
- J. Cohen and A. Nicolau. Comparison of compacting algorithms for garbage collection. ACM Transactions on Programming Languages and Systems, 5(4):532–553, Oct. 1983. OpenAlex ↗ · Scholar ↗
- D. L. Detlefs, A. Dosser, and B. Zorn. Memory allocation costs in large C and C++ programs. Software Practice & Experience, 24(6):527–542, June 1994. OpenAlex ↗ · Scholar ↗
- L. P. Deutsch and D. G. Bobrow. An efficient incremental automatic garbage collector. Communications of the ACM, 19(9):522–526, September 1976. OpenAlex ↗ · Scholar ↗
- S. Dieckmann and U. Hölzle. A study of the allocation behavior of the SPECjvm98 Java benchmarks. In Proceedings of the European Conference on Object-Oriented Programming, pages 92–115, June 1999. OpenAlex ↗ · Scholar ↗
- E. Dijkstra, L. Lamport, A. Martin, C. Scholten, and E. Steffens. On-the-fly garbage collection: An exercise in cooperation. Communications of the ACM, 21(11):966–975, September 1978. OpenAlex ↗ · Scholar ↗
- A. Diwan, D. Tarditi, and J. E. B. Moss. Memory subsystem performance of programs using copying garbage collection. In Conference Record of the Twenty-First ACM Symposium on Principles of Programming Languages, pages 1–14, Portland, OR, Jan. 1994. OpenAlex ↗ · Scholar ↗
- L. Eeckhout, A. Georges, and K. D. Bosschere. How Java programs interact with virtual machines at the microarchitectural level. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 244–358, Anaheim, CA, Oct. 2003. OpenAlex ↗ · Scholar ↗
- R. Fitzgerald and D. Tarditi. The case for profile-directed selection of garbage collectors. In ACM International Symposium on Memory Management, pages 111–120, Minneapolis, MN, Oct. 2000. OpenAlex ↗ · Scholar ↗
- M. W. Hicks, J. T. Moore, and S. Nettles. The measured cost of copying garbage collection mechanisms. In ACM International Conference on Functional Programming, pages 292–305, 1997. OpenAlex ↗ · Scholar ↗
- A. L. Hosking and R. L. Hudson. Remembered sets can also play cards, Oct. 1993. Position paper for OOPSLA ’93 Workshop on Memory Management and Garbage Collection. OpenAlex ↗ · Scholar ↗
- R. E. Jones and R. D. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, July 1996. OpenAlex ↗ · Scholar ↗
- N. P. Jouppi. Improving direct-mapped cache performance by the addition of a small fully-associative cache and prefetch buffers. In Proceedings of the 17th International Symposium on Computer Architecture, pages 364–373, Seattle, WA, June 1990. OpenAlex ↗ · Scholar ↗
- J. Kim and Y. Hsu. Memory system behavior of Java programs: Methodology and analysis. In ACM SIGMETRICS Conference on Measurement & Modeling Computer Systems, pages 264–274, Santa Clara, CA, June 2000. OpenAlex ↗ · Scholar ↗
- D. Lea. A memory allocator. http://gee.cs.oswego.edu/dl/html/malloc.html, 1997. OpenAlex ↗ · Scholar ↗
- Y. Levanoni and E. Petrank. An on-the-fly reference counting garbage collector for Java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 367–380, Tampa, FL, Oct. 2001. OpenAlex ↗ · Scholar ↗
- H. Lieberman and C. E. Hewitt. A real time garbage collector based on the lifetimes of objects. Communications of the ACM, 26(6):419–429, 1983. OpenAlex ↗ · Scholar ↗
- M. Pettersson. Linux Intel/x86 performance counters, 2003. http://user.it.uu.se/ mikpe/linux/perfctr/. OpenAlex ↗ · Scholar ↗
- Y. Shuf, M. J. Serran, M. Gupta, and J. P. Singh. Characterizing the memory behavior of Java workloads: A structured view and opportunities for optimizations. In ACM SIGMETRICS Conference on Measurement & Modeling Computer Systems, pages 194–205, Cambridge, MA, June 2001. OpenAlex ↗ · Scholar ↗
- Standard Performance Evaluation Corporation. SPECjvm98 Documentation, release 1.03 edition, March 1999. OpenAlex ↗ · Scholar ↗
- Standard Performance Evaluation Corporation. SPECjbb2000 (Java Business Benchmark) Documentation, release 1.01 edition, 2001. OpenAlex ↗ · Scholar ↗
- D. Stefanović, M. Hertz, S. M. Blackburn, K. McKinley, and J. Moss. Older-first garbage collection in practice: Evaluation in a Java virtual machine. In Memory System Performance, pages 175–184, June 2002. OpenAlex ↗ · Scholar ↗
- D. Tarditi and A. Diwan. Measuring the cost of storage management. Lisp and Symbolic Computation, 9(4), Dec. 1996. OpenAlex ↗ · Scholar ↗
- D. M. Ungar. Generation scavenging: A non-disruptive high performance storage reclamation algorithm. In ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments, pages 157–167, April 1984. OpenAlex ↗ · Scholar ↗
- B. G. Zorn. The measured cost of conservative garbage collection. Software Practice & Experience, 23(7):733–756, 1993. OpenAlex ↗ · Scholar ↗
This page in Markdown https://md.research.elamur.ai/free/en/papers/blackburn-2004-myths-realities-performance-impact-garbage/