RFR: JDK-8259983: do not use uninitialized expand_ms value in G1CollectedHeap::expand_heap_after_young_collection
Kim Barrett
kbarrett at openjdk.java.net
Tue Jan 19 18:57:44 UTC 2021
On Tue, 19 Jan 2021 15:37:10 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> Currently we could run into an uninitialized value of expand_ms in G1CollectedHeap::expand_heap_after_young_collection() .
> This would happen in case of an early return of bool G1CollectedHeap::expand(size_t expand_bytes, WorkGang* pretouch_workers, double* expand_time_ms) . See the special case in expand
>
> if (is_maximal_no_gc()) {
> log_debug(gc, ergo, heap)("Did not expand the heap (heap already fully expanded)");
> return false;
> }
I considered suggesting instead only calling record_expand_heap_time if
expand succeeds. The underlying value is reset to 0 as part of
G1GCPhaseTimes::reset. But that assumes there aren't any time-consuming
reasons for expand to fail. So this change looks good to me.
-------------
Marked as reviewed by kbarrett (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2148
More information about the hotspot-gc-dev
mailing list