From 9b3f1ad94ac8d3daad17d6112bd21641499eab65 Mon Sep 17 00:00:00 2001 From: brutisso Date: Fri, 20 Jan 2012 18:01:32 +0100 Subject: [PATCH] 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index bf7ee95d5..1544673a3 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1059,8 +1059,14 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size, if (result != NULL) { if (g1_policy()->need_to_start_conc_mark("concurrent humongous allocation")) { - // We need to release the Heap_lock before we try to call collect + // We need to release the Heap_lock before we try to call collect(). + // The result will not be stored in any object before this method + // returns, so the GC might miss it. Thus, we create a handle to the result + // and fake an object at that place. + CollectedHeap::fill_with_object(result, word_size, false); + Handle h((oop)result); collect(GCCause::_g1_humongous_allocation); + assert(result == (HeapWord*)h(), "Humongous objects should not be moved by collections"); } return result; } -- GitLab