6908215: G1: SEGV with G1PolicyVerbose=2 debug flag
authorjohnc
Wed, 09 Dec 2009 23:51:38 -0800
changeset 4473 36af0e48d3d1
parent 4465 7b73e0380188
child 4474 faa140ac71cd
6908215: G1: SEGV with G1PolicyVerbose=2 debug flag Summary: Change CollectionSetChooser::printSortedHeapRegions to handle null entries in _markedRegions growable array. Reviewed-by: jmasa, tonyp, iveresov
hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp
--- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Tue Dec 08 15:12:17 2009 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Wed Dec 09 23:51:38 2009 -0800
@@ -351,9 +351,16 @@
 CollectionSetChooser::printSortedHeapRegions() {
   gclog_or_tty->print_cr("Printing %d Heap Regions sorted by amount of known garbage",
                 _numMarkedRegions);
+
+  DEBUG_ONLY(int marked_count = 0;)
   for (int i = 0; i < _markedRegions.length(); i++) {
-    printHeapRegion(_markedRegions.at(i));
+    HeapRegion* r = _markedRegions.at(i);
+    if (r != NULL) {
+      printHeapRegion(r);
+      DEBUG_ONLY(marked_count++;)
+    }
   }
+  assert(marked_count == _numMarkedRegions, "must be");
   gclog_or_tty->print_cr("Done sorted heap region print");
 }