6742641: G1: NullPointerException during GCOld
authortonyp
Mon, 22 Sep 2008 09:56:49 -0400
changeset 1396 b8deeac307ca
parent 1395 145f3dce244e
child 1397 6a692b557add
6742641: G1: NullPointerException during GCOld Summary: An update buffer is not processed correctly, which causes roots into the collection set not to be scanned and, hence, for the heap to be corrupted. The cause is that an object is accessed after it has been explicitly deleted, which causes a race. Reviewed-by: jcoomes, ysr
hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp
--- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Wed Sep 17 19:59:35 2008 +0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Mon Sep 22 09:56:49 2008 -0400
@@ -208,12 +208,13 @@
                                               nd->index, _sz,
                                               true, worker_i);
     void** buf = nd->buf;
+    size_t index = nd->index;
     delete nd;
     if (b) {
       deallocate_buffer(buf);
       return true;  // In normal case, go on to next buffer.
     } else {
-      enqueue_complete_buffer(buf, nd->index, true);
+      enqueue_complete_buffer(buf, index, true);
       return false;
     }
   } else {