RFR: 8366781: Parallel: Include OS free memory in GC selection heuristics [v3]

Guoxiong Li gli at openjdk.org
Sat Oct 18 08:03:01 UTC 2025


On Fri, 17 Oct 2025 14:24:14 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> src/hotspot/share/gc/parallel/psScavenge.cpp line 525:
>> 
>>> 523: bool PSScavenge::should_attempt_scavenge() {
>>> 524:   const static bool SHOULD_RUN_YOUNG_GC = true;
>>> 525:   const static bool SHOULD_RUN_FULL_GC = false;
>> 
>> These two constants `SHOULD_RUN_YOUNG_GC` and `SHOULD_RUN_FULL_GC` do not seem to be `static`.
>
> It probably doesn't make any difference. I can drop `static` if you prefer.

Generally, the `static` variables in a method are used to save the state of the previous invocation and then used by the following invocations. But we only need a named constant here. So I think it is better to remove the keyword `static`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27068#discussion_r2441759268


More information about the hotspot-gc-dev mailing list