Recently, we accidentally replicated the code that does heap expansion at the end of a GC: init_mutator_alloc_region(); { size_t expand_bytes = g1_policy()->expansion_amount(); if (expand_bytes > 0) { size_t bytes_before = capacity(); if (!expand(expand_bytes)) { // We failed to expand the heap so let's verify that // committed/uncommitted amount match the backing store assert(capacity() == _g1_storage.committed_size(), "committed size mismatch"); assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch"); } } } ... { size_t expand_bytes = g1_policy()->expansion_amount(); if (expand_bytes > 0) { size_t bytes_before = capacity(); // No need for an ergo verbose message here, // expansion_amount() does this when it returns a value > 0. if (!expand(expand_bytes)) { // We failed to expand the heap so let's verify that // committed/uncommitted amount match the backing store assert(capacity() == _g1_storage.committed_size(), "committed size mismatch"); assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch"); } } } This looks to have happened due to a mis-merge. I _think_ it's the second copy that should be deleted (after the comment from it is also applied to the first copy). The original intention was to move the heap expansion code "up" so it is indeed the second copy that should be deleted.
|