diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 16882921fa..8528a51bef 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -2326,7 +2326,9 @@ void ConcurrentMark::completeCleanup() { for (int i = 0; i < should_be_freed_region_length && cur != NULL; i++) { free_heap_physical_memory_total_byte_size += cur->capacity(); bool result = os::free_heap_physical_memory(((char*)cur->bottom()), cur->capacity()); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } cur = cur->next(); } double end_sec = os::elapsedTime(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 99a0ce3269..0437107ec5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1888,7 +1888,9 @@ void G1CollectedHeap::free_heap_physical_memory_after_fullgc() { for (int i = 0; i < reclaim_region_count && cur != NULL; i++) { _free_heap_physical_memory_total_byte_size += cur->capacity(); bool result = os::free_heap_physical_memory(((char*)cur->bottom()), cur->capacity()); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } cur = cur->prev(); } _reclaim_region_count = reclaim_region_count; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp index 2857dbd9c4..8c2e79fee3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp @@ -234,7 +234,9 @@ void G1PageBasedVirtualSpace::uncommit_internal(size_t start_page, size_t end_pa //should madvise the physical memory only after uncommit operation succeed if (res && (FreeHeapPhysicalMemory || (ElasticMaxHeap && ((G1CollectedHeap*)Universe::heap())->exp_EMH_size() > 0))) { bool result = os::free_heap_physical_memory(start_addr, pointer_delta(bounded_end_addr(end_page), start_addr, sizeof(char))); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } } } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp index 445920f5c0..a635e6e312 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp @@ -134,7 +134,9 @@ bool PSVirtualSpace::shrink_by(size_t bytes) { //should try to madvise virtual memory [base_addr, base_addr + bytes] //only after os::uncommit_memory succeed bool result = os::free_heap_physical_memory(base_addr, bytes); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } } } diff --git a/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.cpp b/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.cpp index b7da06cf58..347a9b8ebe 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.cpp @@ -181,7 +181,9 @@ void PS_ElasticMaxHeapOp::doit() { size_t shrink_bytes = old_high - new_old_high; guarantee((shrink_bytes > 0) && (shrink_bytes % os::vm_page_size() == 0), "should be"); bool result = os::free_heap_physical_memory(new_old_high, shrink_bytes); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } } } @@ -205,7 +207,9 @@ void PS_ElasticMaxHeapOp::doit() { size_t shrink_bytes = young_high - new_young_high; guarantee((shrink_bytes > 0) && (shrink_bytes % os::vm_page_size() == 0), "should be"); bool result = os::free_heap_physical_memory(new_young_high, shrink_bytes); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } } } } @@ -349,13 +353,17 @@ void Gen_ElasticMaxHeapOp::doit() { size_t shrink_bytes = (char*)young->reserved().end() - base; if (shrink_bytes > 0) { bool result = os::free_heap_physical_memory(base, shrink_bytes); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } } base = (char*)old->reserved().start() + old_committed; shrink_bytes = (char*)old->reserved().end() - base; if (shrink_bytes > 0) { bool result = os::free_heap_physical_memory(base, shrink_bytes); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } } } _resize_success = true; diff --git a/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.hpp b/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.hpp index 1ba2b47ff5..bd9196b6af 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/elasticMaxHeap.hpp @@ -17,8 +17,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_ELASTIC_MAX_HEAP_OPERATION_HPP -#define SHARE_VM_GC_IMPLEMENTATION_SHARED_ELASTIC_MAX_HEAP_OPERATION_HPP +#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_ELASTIC_MAX_HEAP_HPP +#define SHARE_VM_GC_IMPLEMENTATION_SHARED_ELASTIC_MAX_HEAP_HPP #include "gc_implementation/shared/vmGCOperations.hpp" @@ -88,4 +88,4 @@ class ElasticMaxHeapConfig: AllStatic { _initial_max_heap_size = new_size; } }; -#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ELASTIC_MAX_HEAP_OPERATION_HPP +#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ELASTIC_MAX_HEAP_HPP diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp index 38fc311f74..11d7028f8c 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp @@ -708,7 +708,9 @@ void CollectedHeap::free_heap_physical_memory_after_fullgc(void* start, void* e guarantee (length % page_size == 0, "Invariant") ; _free_heap_physical_memory_total_byte_size = length; bool result = os::free_heap_physical_memory(start_address, length); - guarantee(result, "free heap physical memory should be successful"); + if (!result) { + warning("Failed to free heap physical memory."); + } double end_sec = os::elapsedTime(); _free_heap_physical_memory_time_sec = end_sec - start_sec; _last_full_gc_time = end_sec;