--- old/src/share/vm/gc/g1/g1CollectedHeap.cpp 2015-11-06 11:34:04.436277166 +0100 +++ new/src/share/vm/gc/g1/g1CollectedHeap.cpp 2015-11-06 11:34:04.348274599 +0100 @@ -427,6 +427,11 @@ return new_obj; } +size_t G1CollectedHeap::humongous_obj_size_in_regions(size_t word_size) { + assert(is_humongous(word_size), "Object of size " SIZE_FORMAT " must be humongous here", word_size); + return align_size_up_(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords; +} + // If could fit into free regions w/o expansion, try. // Otherwise, if can expand, do so. // Otherwise, if using ex regions might help, try with ex given back. @@ -436,7 +441,7 @@ verify_region_sets_optional(); uint first = G1_NO_HRM_INDEX; - uint obj_regions = (uint)(align_size_up_(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords); + uint obj_regions = (uint) humongous_obj_size_in_regions(word_size); if (obj_regions == 1) { // Only one region to allocate, try to use a fast path by directly allocating @@ -1036,6 +1041,7 @@ // collection hoping that there's enough space in the heap. result = humongous_obj_allocate(word_size, AllocationContext::current()); if (result != NULL) { + g1_policy()->add_last_old_allocated_bytes(humongous_obj_size_in_regions(word_size) * HeapRegion::GrainBytes); return result; } @@ -5283,6 +5289,8 @@ } void G1CollectedHeap::record_obj_copy_mem_stats() { + g1_policy()->add_last_old_allocated_bytes(_old_evac_stats.allocated() * HeapWordSize); + _gc_tracer_stw->report_evacuation_statistics(create_g1_evac_summary(&_survivor_evac_stats), create_g1_evac_summary(&_old_evac_stats)); }