changeset 35590:39a11b5f4283

8065334: CodeHeap expansion fails although there is uncommitted memory Summary: CodeHeap::expand_by() should commit remaining space if requested expansion size is too large. Reviewed-by: kvn
author thartmann
date Fri, 22 Jan 2016 12:37:32 +0100
parents 92c85abcc872
children 35ab7c6816e9
files hotspot/src/share/vm/memory/heap.cpp
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/memory/heap.cpp	Thu Jan 21 22:23:22 2016 +0300
+++ b/hotspot/src/share/vm/memory/heap.cpp	Fri Jan 22 12:37:32 2016 +0100
@@ -149,6 +149,10 @@
   // expand _memory space
   size_t dm = align_to_page_size(_memory.committed_size() + size) - _memory.committed_size();
   if (dm > 0) {
+    // Use at least the available uncommitted space if 'size' is larger
+    if (_memory.uncommitted_size() != 0 && dm > _memory.uncommitted_size()) {
+      dm = _memory.uncommitted_size();
+    }
     char* base = _memory.low() + _memory.committed_size();
     if (!_memory.expand_by(dm)) return false;
     on_code_mapping(base, dm);