8058446: G1 Hot card cache should use ArrayAllocator to allocate the cache array
authortschatzl
Fri, 20 Feb 2015 16:07:12 +0100
changeset 29203 5024f7b3322c
parent 29202 bcce9add4235
child 29206 b16546c98e0a
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
hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Fri Feb 20 12:43:46 2015 +0100
+++ b/hotspot/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/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.hpp	Fri Feb 20 12:43:46 2015 +0100
+++ b/hotspot/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;