--- old/src/share/vm/gc_implementation/g1/heapRegion.cpp 2013-06-19 12:28:49.686388576 -0700 +++ new/src/share/vm/gc_implementation/g1/heapRegion.cpp 2013-06-19 12:28:49.462542707 -0700 @@ -233,7 +233,13 @@ _offsets.resize(HeapRegion::GrainWords); init_top_at_mark_start(); - _strong_code_root_list->clear(); + + if (_strong_code_root_list != NULL) { + delete _strong_code_root_list; + } + _strong_code_root_list = new (ResourceObj::C_HEAP, mtGC) + GrowableArray(10, 0, NULL, true); + if (clear_space) clear(SpaceDecorator::Mangle); } @@ -366,8 +372,6 @@ _strong_code_root_list(NULL) { _orig_end = mr.end(); - _strong_code_root_list = new (ResourceObj::C_HEAP, mtGC) - GrowableArray(10, 0, NULL, true); // Note that initialize() will set the start of the unmarked area of the // region. hr_clear(false /*par*/, false /*clear_space*/); @@ -597,7 +601,7 @@ // Code roots support -void HeapRegion::push_strong_code_root(nmethod* nm) { +void HeapRegion::add_strong_code_root(nmethod* nm) { assert(nm != NULL, "sanity"); // Search for the code blob from the RHS to avoid // duplicate entries as much as possible @@ -655,7 +659,7 @@ } else { // The reference points into a promotion or to-space region HeapRegion* to = _g1h->heap_region_containing(obj); - to->push_strong_code_root(_nm); + to->add_strong_code_root(_nm); } } } @@ -694,7 +698,7 @@ while (to_be_retained.is_nonempty()) { nmethod* nm = to_be_retained.pop(); assert(nm != NULL, "sanity"); - push_strong_code_root(nm); + add_strong_code_root(nm); } } @@ -1218,5 +1222,3 @@ _offsets.zero_bottom_entry(); _offsets.initialize_threshold(); } - -template class GrowableArray;