src/hotspot/share/gc/g1/g1Arguments.cpp
changeset 52811 ff04b71bf6f1
parent 52148 2d9f8845d0ae
child 52894 8df9cf767f79
--- a/src/hotspot/share/gc/g1/g1Arguments.cpp	Tue Dec 04 11:10:19 2018 +0530
+++ b/src/hotspot/share/gc/g1/g1Arguments.cpp	Mon Dec 03 22:27:24 2018 -0800
@@ -81,6 +81,13 @@
     vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
   }
 
+  // When dumping the CDS archive we want to reduce fragmentation by
+  // triggering a full collection. To get as low fragmentation as
+  // possible we only use one worker thread.
+  if (DumpSharedSpaces) {
+    FLAG_SET_ERGO(uint, ParallelGCThreads, 1);
+  }
+
   if (FLAG_IS_DEFAULT(G1ConcRefinementThreads)) {
     FLAG_SET_ERGO(uint, G1ConcRefinementThreads, ParallelGCThreads);
   }