changeset 7899:01f6c1362694

8058446: G1 Hot card cache should use ArrayAllocator to allocate the cache array Summary: Allocate large hot card caches using OS functions instead of the C heap to avoid native memory exhaustion. Reviewed-by: mgerdin, jwilhelm
author tschatzl
date Fri, 20 Feb 2015 16:07:12 +0100
parents ae3dbd31307f
children 532bf0752bbc
files src/share/vm/gc_implementation/g1/g1HotCardCache.cpp src/share/vm/gc_implementation/g1/g1HotCardCache.hpp
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Fri Feb 20 12:43:46 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Fri Feb 20 16:07:12 2015 +0100
@@ -37,7 +37,7 @@
     _use_cache = true;
 
     _hot_cache_size = (size_t)1 << G1ConcRSLogCacheSize;
-    _hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size, mtGC);
+    _hot_cache = _hot_cache_memory.allocate(_hot_cache_size);
 
     reset_hot_cache_internal();
 
@@ -52,7 +52,8 @@
 G1HotCardCache::~G1HotCardCache() {
   if (default_use_cache()) {
     assert(_hot_cache != NULL, "Logic");
-    FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
+    _hot_cache_memory.free();
+    _hot_cache = NULL;
   }
 }
 
--- a/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp	Fri Feb 20 12:43:46 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp	Fri Feb 20 16:07:12 2015 +0100
@@ -61,6 +61,8 @@
 
   G1CardCounts      _card_counts;
 
+  ArrayAllocator<jbyte*, mtGC> _hot_cache_memory;
+
   // The card cache table
   jbyte**           _hot_cache;