1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Nov 28 14:58:31 2011 +0100 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Dec 07 12:54:51 2011 -0500 1.3 @@ -1549,9 +1549,15 @@ 1.4 _partially_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); 1.5 } 1.6 1.7 - size_t rs_length_diff = _max_rs_lengths - _recorded_rs_lengths; 1.8 - if (rs_length_diff >= 0) 1.9 - _rs_length_diff_seq->add((double) rs_length_diff); 1.10 + // It turns out that, sometimes, _max_rs_lengths can get smaller 1.11 + // than _recorded_rs_lengths which causes rs_length_diff to get 1.12 + // very large and mess up the RSet length predictions. We'll be 1.13 + // defensive until we work out why this happens. 1.14 + size_t rs_length_diff = 0; 1.15 + if (_max_rs_lengths > _recorded_rs_lengths) { 1.16 + rs_length_diff = _max_rs_lengths - _recorded_rs_lengths; 1.17 + } 1.18 + _rs_length_diff_seq->add((double) rs_length_diff); 1.19 1.20 size_t copied_bytes = surviving_bytes; 1.21 double cost_per_byte_ms = 0.0;