AgeBased Garbage Collection Darko Stefanovi Kathryn Mc Kinley
Age-Based Garbage Collection Darko Stefanović, Kathryn Mc. Kinley, J. Eliot B. Moss OOPSLA ‘ 99 CS 395 T: Hadi Esmaeilzadeh February 2009
Outline Scavenging Generational Copying Collection (YO) Runtime Overheads Older-First (OF) Write Barrier and Heap Organization Contributions Statistics
Scavenging U={regions not collected}; assumed live C={regions collected} S={Survivors} G={Garbage}; copied/compacted Work proportional to |S| Copying Pointer-tracking What is the ideal case? What is the best heuristic?
Youngest-Only (YO) Intuition: Mortality rate is higher among young objects : ((! Let C={Young objects} Objective: Minimize |S| Fewer survivors Copy less Track less
Runtime Overheads Copying the survivors Tracking the pointers crossing the boundaries In this case, only old-to-young pointers Write barrier (interleaving pointer-tracking with program execution) Cache: The place program and GC collide! Where is the trade-off?
Runtime Overheads: Early Tenuring (Promotion) Newly objects are promoted … What a shame! They die! Waste of time, space, … What else?
Why Generational Collection Works Well Young objects die more quickly than old objects “generational hypothesis” [Unger’ 84, Hayes’ 91] Most pointers are from younger to older objects [Appel’ 89, Zorn’ 90] Do they apply to object oriented programs? Kathryn’s
Older-First Garbage Collection Many objects die when they are middle age! Give the poor young objects a chance to live!
Older-First Garbage Collection Youngest Oldest Heap window Collection 1 survivors Collection 2 window survivors Kathryn’s Collection 3
The Sweet Spot
Design Decisions Sliding window determines C (Collection region) What is the design decision? What is the trade-off? Other alternatives? Window hits the allocation point Collect/compact objects Reset the window to the oldest objects What is the design decision? What is the trade-off? Other alternatives? Degree of freedom or added complexity? Who can help?
Write Barrier: Pointer Filtering for Older-First allocation oldest next collection youngest stored pointer, no store Runtime pointer direction filtering Do not record Pointers within the same block Pointers with source collected before target How can architecture help? Kathryn’s
Trace Based Measurements Fully accurate traces All pointers between objects Precise object life times (collect after every allocation) Measured costs Copying Write barrier Remembered set processing Unmeasured effects Cache / locality interactions Startup What is the net speedup? Kathryn’s
Total Cost Java. BYTEmark Kathryn’s
Total Cost Richards (Smalltalk)
Total Cost Bloat-Bloat Kathryn’s
Contributions More accurate explanations of generational collection (My favorite : ))! Significant reduction in copying cost, by trading off pointer maintenance costs New write barrier mechanisms New promising algorithm Kathryn’s
Citation Statistics ACM portal: 28 Google scholar: 61 Narendran Sachindran , J. Eliot , B. Moss, Mark-copy: fast copying GC with less space overhead, ACM SIGPLAN Notices, v. 38 n. 11, November 2003 Feng Xian , Witawas Srisa-an , Hong Jiang, Allocation-phase aware thread scheduling policies to improve garbage collection performance, Proceedings of the 6 th international symposium on Memory management, October 21 -22, 2007, Montreal, Quebec, Canada Sebastien Marion , Richard Jones , Chris Ryder, Decrypting the Java gene pool, Proceedings of the 6 th international symposium on Memory management, October 21 -22, 2007, Montreal, Quebec, Canada William D. Clinger , Fabio V. Rojas, Linear combinations of radioactive decay models for generational garbage collection, Science of Computer Programming, v. 62 n. 2, p. 184 -203, 1 October 2006 Feng Xian , Witawas Srisa-an , Hong Jiang, Garbage collection: Java application servers' Achilles heel, Science of Computer Programming, v. 70 n. 2 -3, p. 89 -110, February, 2008
Resources Ben Wiedermann’s presentation in 2003 class Improving Memory Performance for Java, Kathryn Mc. Kinley, CRA-W Distinguished Lecture, ECE CMU, 2000, http: //amp. ece. cmu. edu/eceseminar/2000/Fall /Abstract/F 00_Mc. Kinley. htm
Youngest Only GC Youngest Oldest Heap uncollected window Collection 1 survivors uncollected window survivors Collection 2
Generational GC with 2 Generations nursery Oldest Youngest Heap reserve uncollected survivors reserve uncollected window freed from reserve window survivors freed window reserve Collection 1 Collection 2 from reserve Collection 3
- Slides: 21