comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 4833:57025542827f

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
author brutisso
date Fri, 20 Jan 2012 18:01:32 +0100
parents 7ca7be5a6a0b
children 6a78aa6ac1ff
comparison
equal deleted inserted replaced
4832:a8a126788ea0 4833:57025542827f
1057 } 1057 }
1058 } 1058 }
1059 1059
1060 if (result != NULL) { 1060 if (result != NULL) {
1061 if (g1_policy()->need_to_start_conc_mark("concurrent humongous allocation")) { 1061 if (g1_policy()->need_to_start_conc_mark("concurrent humongous allocation")) {
1062 // We need to release the Heap_lock before we try to call collect 1062 // We need to release the Heap_lock before we try to call collect().
1063 // The result will not be stored in any object before this method
1064 // returns, so the GC might miss it. Thus, we create a handle to the result
1065 // and fake an object at that place.
1066 CollectedHeap::fill_with_object(result, word_size, false);
1067 Handle h((oop)result);
1063 collect(GCCause::_g1_humongous_allocation); 1068 collect(GCCause::_g1_humongous_allocation);
1069 assert(result == (HeapWord*)h(), "Humongous objects should not be moved by collections");
1064 } 1070 }
1065 return result; 1071 return result;
1066 } 1072 }
1067 1073
1068 if (should_try_gc) { 1074 if (should_try_gc) {