This talk aims to give overview of memory management and Garbage Collection and a new look to the typical process of Garbage Collection.
Speaker:
Dr. Rifat Shahriyar
Assistant Professor
Department of Computer Science and Engineering
Bangladesh University of Engineering and Technology
2. Who Am I?
• Asst. Prof., Dept. of CSE, BUET
• PhD from Australian National University
(ANU)
• Dissertation title
– High Performance Reference Counting and
Conservative Garbage Collection
• Supervised by
– Steve Blackburn (ANU)
– Kathryn McKinley (MSR)
2
5. Today Garbage collection is
ubiquitous
• GC algorithms
– Tracing and Reference counting
• GC implementations
– Exact and Conservative
✔ Tracing and Exact in all highly engineered,
high performance systems
✘ Reference counting and conservative only
in non-performance critical settings
5
9. Immix [Blackburn and McKinley 2008]
• Contiguous allocation into regions
– 256B lines and 32KB blocks
– Objects span lines but not blocks
• Simple mark phase
– Mark objects and containing regions
• Free unmarked regions
• Recycled allocation and defragmentation
9
block
line
recyclable linesobject mark line mark
10. Down for the Count?
Getting Reference Counting
Back in the Ring
ISMM’12
10
14. Problem
✔ One of the two fundamental GC algorithms
✔ Many advantages
✘ Neglected by performance-conscious VMs
So how much slower is it?
Can we get RC back in the ring?
14
30%
15. Optimizing RC
• Limited bit count
– Use just few bits, fix o/f with backup tracing
• Elision of new object counts
– Only do RC work if object survives the first GC
• Born as dead
– Avoid free-list work for short lived objects
15
16. 16
New RC ≈ MS
Optimized RC vs. MS
-20%
0%
20%
40%
60%
80%
compress
jess
db
javac
mtrt
jack
avrora
bloat
eclipse
fop
hsqldb
luindex
pmd
sunflow
xalan
pjbb2005
geomean
faster←Time→slower
Old RC New RC
17. Summary
• Old RC
– 30% slower than MS
– 40% slower than production
• New RC
– Limited bit count
– Optimization for new objects
• Performance
– Matches MS
– Still 10% slower than production
17
40%
10%
TotalTimevProduction
< 2012 2012
18. Taking Off the Gloves with
Reference Counting Immix
OOPSLA’13
18
20. Looking a Little Deeper…
10% 9%
32%
7%
4%
28%
-2% -3% -2%-3% -3%
1%
MutatorvProduction
RC MS SS Immix
20
Time Instructions
Retired
L1 D
Cache Misses
21. Looking a Little Deeper…
10% 9%
32%
7%
4%
28%
-2% -3% -2%-3% -3%
1%
MutatorvProduction
RC MS SS Immix
21
Time Instructions
Retired
L1 D
Cache Misses
Free List
Bump Pointer
22. Goal & Challenge
• Goal
– Object-local collection
– Excellent mutator locality
– Copying to eliminate fragmentation
• Immix provides opportunistic copying
✔ Same mutator locality as contiguous allocator
• However, RC is inherently local
– References to an object generally unknown
– but copying must redirect all references
22
23. RC Immix
✔ Combines RC and Immix
✔ Line/block reclamation
✔ Line live object count with object reference count
✔ Exploit Immix’s opportunistic copy
✔ Observe new objects can be copied by first GC
✔ Observe old objects can be copied by backup GC
23
24. Total time
3% faster then Gen Immix, +6% worst case, -21% best case
24
-30%
-20%
-10%
0%
10%
20%
30%
40%
compress
jess
db
javac
mtrt
jack
avrora
bloat
eclipse
fop
hsqldb
jython
luindex
lusearchfix
pmd
sunflow
xalan
pjbb2005
geomean
faster←Time→slower
RC RC Immix