< prev index next >

src/hotspot/share/gc/g1/heapRegion.cpp

Print this page

@@ -64,10 +64,17 @@
   size_t region_size = G1HeapRegionSize;
   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
     region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(),
                        HeapRegionBounds::min_size());
+    if (DumpSharedSpaces && max_heap_size >= 128*M && region_size < 8*M) {
+      // CDS archived heap supports up to 32G heaps, with region size up to 8MB.
+      // At CDS dump time, if we use small regions for G1, the CARC and OARC regions may end up
+      // in the same 8MB block. At run time with a large heap, G1CollectedHeap::alloc_archive_regions
+      // might fail because CARC and OARC will end up in the same G1 region.
+      region_size = 8*M;
+    }
   }
 
   int region_size_log = log2_long((jlong) region_size);
   // Recalculate the region size to make sure it's a power of
   // 2. This means that region_size is the largest power of 2 that's
< prev index next >