hotspot/src/share/vm/gc_interface/collectedHeap.cpp
changeset 10519 fb373fa38321
parent 10282 aa2bcd7f4149
parent 10501 5bce84af0883
child 10565 dc90c239f4ec
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Fri Sep 02 21:33:57 2011 -0700
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Wed Sep 07 11:52:00 2011 -0700
@@ -157,8 +157,14 @@
     // ..and clear it.
     Copy::zero_to_words(obj, new_tlab_size);
   } else {
-    // ...and clear just the allocated object.
-    Copy::zero_to_words(obj, size);
+    // ...and zap just allocated object.
+#ifdef ASSERT
+    // Skip mangling the space corresponding to the object header to
+    // ensure that the returned space is not considered parsable by
+    // any concurrent GC thread.
+    size_t hdr_size = oopDesc::header_size();
+    Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
+#endif // ASSERT
   }
   thread->tlab().fill(obj, obj + size, new_tlab_size);
   return obj;