Fri, 20 Jan 2012 18:01:32 +0100
7131791: G1: Asserts in nightly testing due to 6976060
Summary: Create a handle and fake an object to make sure that we don't loose the memory we just allocated
Reviewed-by: tonyp, stefank
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Jan 19 09:13:58 2012 -0500 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Jan 20 18:01:32 2012 +0100 1.3 @@ -1059,8 +1059,14 @@ 1.4 1.5 if (result != NULL) { 1.6 if (g1_policy()->need_to_start_conc_mark("concurrent humongous allocation")) { 1.7 - // We need to release the Heap_lock before we try to call collect 1.8 + // We need to release the Heap_lock before we try to call collect(). 1.9 + // The result will not be stored in any object before this method 1.10 + // returns, so the GC might miss it. Thus, we create a handle to the result 1.11 + // and fake an object at that place. 1.12 + CollectedHeap::fill_with_object(result, word_size, false); 1.13 + Handle h((oop)result); 1.14 collect(GCCause::_g1_humongous_allocation); 1.15 + assert(result == (HeapWord*)h(), "Humongous objects should not be moved by collections"); 1.16 } 1.17 return result; 1.18 }