src/share/vm/gc_implementation/g1/concurrentMark.hpp

Print this page
rev 3631 : 7188263: G1: Excessive c_heap (malloc) consumption
Summary: G1 was allocating the global marking stack and some per-worker marking data structures from C heap, resulting in approximately 7Mb being allocated for each marking thread. Reduce the pressure on the C heap by allocating some of these marking structures from virtual memory instead.
Reviewed-by:

@@ -162,10 +162,11 @@
   oop*   _base;        // bottom of stack
   jint   _index;       // one more than last occupied index
   jint   _capacity;    // max #elements
   jint   _saved_index; // value of _index saved at start of GC
   NOT_PRODUCT(jint _max_depth;)  // max depth plumbed during run
+  VirtualSpace _virtual_space;   // Underlying backing store for actual stack
 
   bool   _overflow;
   DEBUG_ONLY(bool _drain_in_progress;)
   DEBUG_ONLY(bool _drain_in_progress_yields;)
 

@@ -383,10 +384,13 @@
   CMBitMap*               _nextMarkBitMap; // under-construction mark bitmap
 
   BitMap                  _region_bm;
   BitMap                  _card_bm;
 
+  VirtualSpace            _virtual_space; // Backing store for worker liveness
+                                          // counting structures
+
   // Heap bounds
   HeapWord*               _heap_start;
   HeapWord*               _heap_end;
 
   // Root region tracking and claiming.

@@ -634,11 +638,11 @@
   // Attempts to steal an object from the task queues of other tasks
   bool try_stealing(int task_num, int* hash_seed, oop& obj) {
     return _task_queues->steal(task_num, hash_seed, obj);
   }
 
-  ConcurrentMark(ReservedSpace rs, uint max_regions);
+  ConcurrentMark(ReservedSpace heap_rs, uint max_regions);
   ~ConcurrentMark();
 
   ConcurrentMarkThread* cmThread() { return _cmThread; }
 
   CMBitMapRO* prevMarkBitMap() const { return _prevMarkBitMap; }