RFR (XS): 8014405: G1: PerRegionTable::fl_mem_size() calculates size of the free list using wrong element sizes
thomas.schatzl at oracle.com
Wed May 15 08:22:52 UTC 2013
can I have reviews for the following change?
It fixes the memory usage calculation for the G1 fine remembered set
free list. Previously it summed up only sizes of the PerRegionTable
object instances, missing out on memory allocated on the heap.
jprt (which runs the unit tests)
The main patch is the one-liner in heapRegionRemSet.cpp,
The other changes add support code for unit testing: note that since
PerRegionTable is a private class, and I preferred to not make it
public, the test invocation is funneled through the new
HeapRegionRemSet::test_prt() method. Which I think is okay, since
PerRegionTable is a component of HeapRegionRemSet.
This test method is then invoked by the code in jni.cpp.
The test itself is straightforward: allocate a PerRegionTable instance,
free it to put it on the free list, and compare the sizes reported by
the PerRegionTable instance and the PerRegionTable::fl_mem_size()
Some nits: Since there is no way to clean up a PerRegionTable instance
(and the original code never does), if you run the unit tests, this may
be considered a memory leak.
Properly cleaning up would require quite a few additions to other
classes though so I did not implement it just for the test. If you
consider this important, I will add this, but it seemed that this added
a lot of noise to the one-line patch.
More information about the hotspot-gc-dev