6912018: CMS: guarantee(head() != 0,"The head of the list cannot be NULL")
authorjmasa
Thu, 07 Jan 2010 08:14:45 -0800
changeset 4577 18d854d28d4e
parent 4576 ad45d4e37837
child 4578 8c2778d19ffa
6912018: CMS: guarantee(head() != 0,"The head of the list cannot be NULL") Summary: Block too small to split was not correctly putback to free lists. Reviewed-by: ysr
hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon Jan 04 14:51:26 2010 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Thu Jan 07 08:14:45 2010 -0800
@@ -3075,7 +3075,18 @@
     if (rem > 0 && rem < MinChunkSize) {
       n--; rem += word_sz;
     }
-    assert((ssize_t)n >= 1, "Control point invariant");
+    // Note that at this point we may have n == 0.
+    assert((ssize_t)n >= 0, "Control point invariant");
+
+    // If n is 0, the chunk fc that was found is not large
+    // enough to leave a viable remainder.  We are unable to
+    // allocate even one block.  Return fc to the
+    // dictionary and return, leaving "fl" empty.
+    if (n == 0) {
+      returnChunkToDictionary(fc);
+      return;
+    }
+
     // First return the remainder, if any.
     // Note that we hold the lock until we decide if we're going to give
     // back the remainder to the dictionary, since a concurrent allocation