From 336a58bdc5a51d1aef6ad2e817635ed4d7520319 Mon Sep 17 00:00:00 2001 From: tschatzl Date: Wed, 3 Sep 2014 09:24:07 +0200 Subject: [PATCH] 8056043: Heap does not shrink within the heap after JDK-8038423 Summary: Enable shrinking within the heap by removing some code added for JDK-8054818. Enable the test case that checks that again too. Reviewed-by: jwilhelm, jmasa --- src/share/vm/gc_implementation/g1/heapRegionManager.cpp | 4 ---- test/gc/g1/TestHumongousShrinkHeap.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/src/share/vm/gc_implementation/g1/heapRegionManager.cpp index 50661699e..29f46b31f 100644 --- a/src/share/vm/gc_implementation/g1/heapRegionManager.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegionManager.cpp @@ -351,10 +351,6 @@ uint HeapRegionManager::shrink_by(uint num_regions_to_remove) { while ((removed < num_regions_to_remove) && (num_last_found = find_empty_from_idx_reverse(cur, &idx_last_found)) > 0) { - // Only allow uncommit from the end of the heap. - if ((idx_last_found + num_last_found) != _allocated_heapregions_length) { - return 0; - } uint to_remove = MIN2(num_regions_to_remove - removed, num_last_found); uncommit_regions(idx_last_found + num_last_found - to_remove, to_remove); diff --git a/test/gc/g1/TestHumongousShrinkHeap.java b/test/gc/g1/TestHumongousShrinkHeap.java index c790c6464..5a15f9f11 100644 --- a/test/gc/g1/TestHumongousShrinkHeap.java +++ b/test/gc/g1/TestHumongousShrinkHeap.java @@ -23,7 +23,7 @@ /** * @test TestHumongousShrinkHeap - * @bug 8036025 + * @bug 8036025 8056043 * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects * @library /testlibrary * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap -- GitLab