160 likes | 313 Views
Mark-Compact Sweep Garbage Collection & Automatic Heap Resizing: A Valuable Combination. The Problem. Processes require different heap sizes Mark sweep garbage collectors have some disadvantages What combination of heap size and garbage collection will increase performance?.
E N D
Mark-Compact Sweep Garbage Collection & Automatic Heap Resizing: A Valuable Combination
The Problem • Processes require different heap sizes • Mark sweep garbage collectors have some disadvantages • What combination of heap size and garbage collection will increase performance?
Problem with Heap Sizes Small heap Large Heap
Problem with Mark Sweep Garbage Collection (a) Before Collection (b) After Collection
The Solution • Run the Dacapo Suite and GCBench benchmarks on the Jikes RVM using several different configurations: • MSwithHR • MSwithoutHR • MSCwithHR • MSCwithoutHR • NOGCwithHR
Benchmarks (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.
Heap Resizing Algorithm • 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
Conclusions • 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.
Conclusions • 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
Conclusions • While the amount of time spent in garbage collection and heap resizing varies in cases in which the program’s footprint is much smaller than the maximum heap size, both amount approximately to the same execution times