Title: Mark-Compact Sweep Garbage Collection
1Mark-Compact Sweep Garbage Collection
Automatic Heap Resizing A Valuable Combination
2The Problem
- Processes require different heap sizes
- Mark sweep garbage collectors have some
disadvantages - What combination of heap size and garbage
collection will increase performance?
3Problem with Heap Sizes
Small heap
Large Heap
4Problem with Mark Sweep Garbage Collection
Garbage Live Live Garbage Live
(a) Before Collection
Live Live Live
(b) After Collection
5The Solution
- Run the Dacapo Suite and GCBench benchmarks on
the Jikes RVM using several different
configurations - MSwithHR
- MSwithoutHR
- MSCwithHR
- MSCwithoutHR
- NOGCwithHR
6Benchmarks (Dacapo Suite)
Benchmark Description
Antlr parses one or more grammar files and generates a parser and lexical analyzer for each.
Fop takes an XSL-FO file, parses it and formats it, generating a PDF file.
Jython interprets a series of Python programs
Pmd analyzes a set of Java classes for a range of source code problems
Ps reads and interprets a PostScript file
7Benchmarks (GCBench)
- focuses on modeling allocation requests in ways
that are especially stressful to memory - objects are allocated to create trees of
differing heights and sizes.
8Heap Resizing Algorithm
0 0 0.1 0.3 0.6 0.8 1
0 0.9 0.9 0.95 1 1 1
0.02 0.9 0.9 0.95 1 1 1
0.05 0.95 0.95 1 1 1 1
0.15 1 1 1.1 1.15 1.2 1.2
0.3 1 1 1.2 1.25 1.35 1.3
0.5 1 1 1.25 1.3 1.5 1.5
1 1 1 1.25 1.3 1.5 1.5
- Calculate the live ratio (amount of memory in
use/current heap size) - Calculate heap change ratio
- How much garbage collection has been done?
- Calculate heap change ratio based on live ratio,
GC Load and function matrix - New size old heap size heap change ratio
- If new size ! old size
- Change the heap size
- Inform VM that the heap size has changed
9Results (GCBench)
10Results (fop)
11Garbage Collection Results
12Garbage Collection Results
13Conclusions
- The variation of mark compact sweep implemented
in the Jikes RVM works just as well as the basic
mark sweep algorithm, even in the face of
compaction and when complemented with automatic
heap resizing - In some cases, we need to examine the application
itself to determine which algorithm is better
suited for our needs.
14Conclusions
- Only using garbage collection gives worse
performance than choosing heap resizing in
conjunction with garbage collection in situations
in which we do not have adequate memory to
execute our entire program - Only using heap resizing gives worse performance
in situations in which the footprint of the
application is much smaller than the maximum heap
size. In these situations, a conjunction of heap
resizing with automatic garbage collection gives
the best performance
15Conclusions
- While the amount of time spent in garbage
collection and heap resizing varies in cases in
which the programs footprint is much smaller
than the maximum heap size, both amount
approximately to the same execution times
16Questions??