--- old/src/share/vm/utilities/bitMap.cpp 2014-03-21 10:34:36.148190498 +0100 +++ new/src/share/vm/utilities/bitMap.cpp 2014-03-21 10:34:36.028185762 +0100 @@ -68,13 +68,17 @@ if (in_resource_area) { _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); } else { - if (old_map != NULL) { + _map = _map_allocator.allocate(new_size_in_words); + } + + if (old_map != NULL) { + Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, + MIN2(old_size_in_words, new_size_in_words)); + if (!in_resource_area) { _map_allocator.free(); } - _map = _map_allocator.allocate(new_size_in_words); } - Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, - MIN2(old_size_in_words, new_size_in_words)); + if (new_size_in_words > old_size_in_words) { clear_range_of_words(old_size_in_words, size_in_words()); }