src/share/vm/gc_interface/collectedHeap.cpp

changeset 3092
baf763f388e6
parent 2708
1d1603768966
child 3110
d968f546734e
     1.1 --- a/src/share/vm/gc_interface/collectedHeap.cpp	Thu Aug 25 20:29:30 2011 -0700
     1.2 +++ b/src/share/vm/gc_interface/collectedHeap.cpp	Fri Aug 26 08:52:22 2011 -0700
     1.3 @@ -157,8 +157,14 @@
     1.4      // ..and clear it.
     1.5      Copy::zero_to_words(obj, new_tlab_size);
     1.6    } else {
     1.7 -    // ...and clear just the allocated object.
     1.8 -    Copy::zero_to_words(obj, size);
     1.9 +    // ...and zap just allocated object.
    1.10 +#ifdef ASSERT
    1.11 +    // Skip mangling the space corresponding to the object header to
    1.12 +    // ensure that the returned space is not considered parsable by
    1.13 +    // any concurrent GC thread.
    1.14 +    size_t hdr_size = oopDesc::header_size();
    1.15 +    Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
    1.16 +#endif // ASSERT
    1.17    }
    1.18    thread->tlab().fill(obj, obj + size, new_tlab_size);
    1.19    return obj;

mercurial