Download presentation
Presentation is loading. Please wait.
Published byCamron Horn Modified over 9 years ago
1
Immix: A Mark-Region Garbage Collector Curtis Dunham CS 395T Presentation Feb 2, 2011 Thanks to Steve Blackburn and Jennifer Sartor for their 2008 and 2009 Immix presentations, respectively.1 I believe this presentation to be ~95% Steve’s PLDI talk and ~4% Jennifer Sartor’s 395T presentation and < 1% mine
2
Comparison to Prior Work; Contributions 2 Space efficiency Fast Collection Mutator Performance Copying Mark-Sweep Mark-Compact Status Quo Before This Work Status Quo Before This Work Post-Immix: The New World of GC Post-Immix: The New World of GC Immix: Mark-Region w/ Opportunistic Defragmentation Immix: Mark-Region w/ Opportunistic Defragmentation Bump Pointer Non-Semispace Does both (every object either marked or copied) In One Pass Does both (every object either marked or copied) In One Pass Locality
3
GC Fundamentals Algorithmic Components AllocationReclamation 3 Identification Bump Allocation Free List ` Tracing (implicit) Reference Counting (explicit) Sweep-to-Free Compact Evacuate 31
4
Mark-Compact [Styger 1967] Bump allocation + trace + compact GC Fundamentals Canonical Garbage Collectors Thanks to Steve for his Immix presentation from 2008. 4 ` Sweep-to-Free Compact Evacuate Mark-Sweep [McCarthy 1960] Free-list + trace + sweep-to-free Semi-Space [Cheney 1970] Bump allocation + trace + evacuate
5
Sweep-To-Region and Mark-Region 5 ` Sweep-to-Free Compact Evacuate Reclamation Sweep-to-Region Mark-Sweep Free-list + trace + sweep-to-free Mark-Compact Bump allocation + trace + compact Semi-Space Bump allocation + trace + evacuate Mark-Region Bump alloc + trace + sweep-to-region
6
Naïve Mark-Region 6 Contiguous allocation into regions Excellent locality – For simplicity, objects cannot span regions Simple mark phase (like mark-sweep) – Mark objects and their containing region Unmarked regions can be freed
7
Heap Organization Blocks – analogous to Regions – Recyclable – Immix block = 32KB Lines – Objects can span lines – Immix line = 128B Opportunistic defragmentation – Candidate and target blocks – Single pass to mark and copy 7 Reusable for (more) allocation 256 per Block Move from mostly-empty to mostly-full Move from mostly-empty to mostly-full
8
Immix: Lines and Blocks 8 Small Regions Large Regions ✗ Fragmentation (can’t fill blocks) ✓ More contiguous allocation ✗ Fragmentation (false marking) Lines & Blocks N pagesapprox 1 cache line ✓ Less fragmentation Objects span lines ✓ Fast common case Lines marked with objects ✗ Increased metadata o/h ✗ Constrained object sizes TLB locality, cache locality Block > 4 X max object size Free Recyclable “In a mark-region collector, region size embodies the collector’s space-time tradeoff.” Recyclable
9
Allocation Policy (Recycling) 9 Recycle partially marked blocks first Minimize fragmentation Maximize sharing of freed blocks Recycle in address order – We explored other options Allocate into free blocks last Effect on locality and fragmentation?
10
Opportunistic Defragmentation 10 Identify source and target blocks – (see paper for heuristics) Evacuate objects in source blocks – Allocate into target blocks Opportunistic – Leave in place if no space, or object pinned Opportunistically evacuate fragmented blocks – Lightweight, uses same allocation mechanism – No cost in common case (specialized GC) Source = most holes Other heuristics?
11
Details Parallelizable – Coarse sweeping – Defragmentation Demand-driven overflow allocations – Medium objects Metadata space overheads – For parallel synch: mark bytes (not bits) – Line and block mark, not just object mark – Defragmentation headroom – Overflow allocation block – Conservative line marking 11
12
Other Optimizations 12 Implicit Marking ✓ Most objects small Small objects implicitly mark next line ✓ V. Fast common case Large objects mark lines exactly Implicit line mark Line mark Overflow Allocation Multi-line objects may skip many small holes Overflow allocation (used on failure) ✓ Large objects uncommon ✓ V. effective solution ✓ ✓
13
Mark-Region: Immix (Bump Allocation + Trace + Sweep-to-Region) 13 ✓ ✓ Simple, very fast collection ✓ ✓ Space efficient ✓ ✓ Good locality Actual data, taken from geomean of DaCapo, jvm98, and jbb2000 on 2.4GHz Core 2 Duo ✓ ✓ Excellent performance Excellent performance
14
Total Performance 14 Geomean of DaCapo, jvm98 and jbb2000 on 2.4GHz Core 2 Duo
15
Discussion Necessity of two-level hierarchy? Caching/Paging? – Efficacy of tuned line/block sizes: e.g. actual TLB miss reduction? Implicit Marking – advantages overcome possible fragmentation? Methodology and Results 15
16
Minimum Heap 16
17
Sticky Performance 17 Geomean of DaCapo, jvm98 and jbb2000 on 2.4GHz Core 2 Duo Benefits of Sticky?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.