Generational Generational Garbage Collection Garbage Collection
Mirko Jerrentrup, Jerrentrup@interactive-software.de
Generational Generational Garbage Collection Garbage Collection - - PowerPoint PPT Presentation
Generational Generational Garbage Collection Garbage Collection Mirko Jerrentrup, Jerrentrup@interactive-software.de Overview Overview motivation at a glance issues problems and limitations conclusion Motivation
Mirko Jerrentrup, Jerrentrup@interactive-software.de
„classical“, e.g. copying GC:
→ reduced pause times → better collection efficiency
→ reduced pause times → better collection efficiency
„Most objects die young.“
[Ungar, 1984]
(major collection)
(minor collection)
Example Example: : minor minor collection collection
young generation root set root set
young generation
root set for minor collection root set for minor collection
live nodes „garbage“ nodes
Inter-generational pointer Inter-generational pointer
Issues Issues in in generational garbage collection generational garbage collection
promotion promotion heap organization heap organization scheduling scheduling inter-generational pointers inter-generational pointers
generational garbage collection generational garbage collection
promotion promotion
heap organization heap organization scheduling scheduling inter-generational pointers inter-generational pointers
generational garbage collection generational garbage collection
Promotion Promotion
late promotion early promotion
long-living objects
better worse
short-living objects
better worse
time
Promotion Promotion policies policies
fixed fixed adaptive adaptive
Promotion policies Promotion policies
Appel‘s collector for SML/NJ demographic feedback- mediated tenuring
Appel Appel‘s ‘s collector for collector for SML/NJ (1) SML/NJ (1)
very large young generation
[Appel, 1989]
Idea: manage promotion rates by fixing heap occupancy of young objects
Appel Appel‘s ‘s collector for collector for SML/NJ (2) SML/NJ (2)
equal size
free reserve
new reserve free reserve
svr free
svr free reserve
free
equal size
free
svr
half heap size
Demographic Demographic feedback feedback-
mediated tenuring (1) (1)
[Ungar, Jackson 1992]
Idea: promote only when necessary to hold maximum pause time
pause time acceptable
free
Demographic Demographic feedback feedback-
mediated tenuring (2) (2)
[Ungar, Jackson 1992] free
No promotion at next collection
survivors survivors
promotion of 150 bytes „oldest“ objects 150 bytes
age size of age group 1 2 3 300 bytes 200 bytes 100 bytes
number of survived collections number of survived collections size of objects in age group size of objects in age group
young generation
maximum acceptable pause time
promotion promotion
heap organization heap organization
scheduling scheduling inter-generational pointers inter-generational pointers
generational garbage collection generational garbage collection
Heap organization Heap organization Determination of object‘s generation
contigious heaps → object adress non-contigious heaps → header field or page-table
Heap organization schemes Heap organization schemes
creation space creation space „high water mark“ bucket system „high water mark“ bucket system
heap organization schemes heap organization schemes
Creation Creation space space (1) (1) Organization of a generation:
[Ungar, 1984]
Goals:
gc pause
Creation Creation space space (2) (2)
[Ungar, 1984]
time generation
creation space aging semi- spaces
„High „High water mark water mark“ “ bucket bucket system (1) system (1)
[Wilson, Moher 1989]
Goals:
Organization of generations:
„High „High water mark water mark“ “ bucket bucket system (2) system (2)
[Wilson, Moher 1989]
time heap
younger generation next generation bucket 1 bucket 2 high water mark
„High „High water mark water mark“ “ bucket bucket system ( system (3 3) )
[Wilson, Moher 1989]
„high water mark” effect:
promotion promotion heap organization heap organization
scheduling scheduling
inter-generational pointers inter-generational pointers
generational garbage collection generational garbage collection
Perform collection when :
hide collection from user hide collection from user efficent collection efficent collection
Collection scheduling Collection scheduling
can be expected
Efficient collections Efficient collections
much garbage (root of a large tree etc.)
[Hayes 1991]
special large object area
Key (large) objects :
[Hayes 1991]
Efficient collections Efficient collections – – key objects key objects (1) (1)
young generation root set
key object key object
[Hayes 1991]
Efficient collections Efficient collections – – key objects key objects (2) (2)
young generation root set key objects keyed area
promotion promotion heap organization heap organization scheduling scheduling
inter-generational pointers inter-generational pointers
generational garbage collection generational garbage collection
Inter Inter-
generational pointers
Issues:
young generation root set
root set for young generation root set for young generation
Inter-generational pointer Inter-generational pointer
Inter Inter-
generational pointer handling
detecting individual pointers detecting individual pointers marking pointer- containing areas marking pointer- containing areas
page / word / card marking detection / storing of inter- generational pointers detection / storing of inter- generational pointers
inter-generational pointer handling inter-generational pointer handling
Detection Detection Detection of inter-generational pointers:
write-barrier write-barrier
Individual pointers Individual pointers – – entry entry table table Idea: indirect pointers through an entry table
[Liebermann, Hewitt 1983] generation 2 generation 1 generation 0
Individual pointers Individual pointers – – entry entry table table Idea: indirect pointers through an entry table
[Liebermann, Hewitt 1983] trapping stores (by mutator) inter-generationalpointer- handling at collection time small constant for every store O(#stores), small constant O(#stores)
N/A
time space
all pointers in the entry table are added to the root set
generation 2 generation 1 generation 0 entry table entry table
Individual pointers Individual pointers – – remembered set remembered set Idea: remember objects with old-young pointers
[Ungar 1984] trapping stores (by mutator) inter-generationalpointer- handling at collection time time space small constant for every store
N/A
pointer- containers O(# ) pointer- containers O(# )
no duplicate entries in set due to bit in object header Objects are scanned for pointers: O(size of objects)
young generation
Pointer Pointer areas areas – – page marking page marking Idea: mark (virtual) memory pages containing
[Shaw 1988] [Moon 1984] trapping stores (by mutator) inter-generationalpointer- handling at collection time time space
N/A
# i.g.p. • size of page O( )
N/A
small constant for every store
pages are scanned for pointers
Pointer Pointer areas areas – – card marking card marking Idea: don´t mark to-large pages
[Wilson, Moher 1989]
[Sobalvarro 1988] trapping stores (by mutator) inter-generationalpointer- handling at collection time time space small constant for every store
N/A
small portion
cards are scanned for pointers
# i.g.p. • size of card O( )
Remembered sets Remembered sets vs.
card marking remembered sets (with sequential store buffers):
Remembered sets Remembered sets vs.
card marking card marking
Remembered sets Remembered sets vs.
card marking
[Hosking, Hudson 1993]
hybrid card marking / remembered set GC
are added to remembered set
Problems and limitations Problems and limitations heuristic failure:
„pig in the snake“
Conclusion Conclusion