RFR: 8365880: Shenandoah: Unify memory usage accounting in ShenandoahFreeSet [v23]
Y. Srinivas Ramakrishna
ysr at openjdk.org
Thu Oct 9 02:31:15 UTC 2025
On Tue, 7 Oct 2025 21:58:02 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> src/hotspot/share/gc/shared/gc_globals.hpp line 472:
>>
>>> 470: product(size_t, SoftMaxHeapSize, 0, MANAGEABLE, \
>>> 471: "Soft limit for maximum heap size (in bytes)") \
>>> 472: constraint(SoftMaxHeapSizeConstraintFunc,AfterMemoryInit) \
>>
>> Changing a common file might raise eyebrows. Why do we need this?
>
> ShenandoahHeap::initialize() makes use of SoftMaxHeapSize. If the SoftMaxHeapSizeConstraintFunc is handled "after memory init", the value of SoftMaxHeapSize is not yet available when we try to use it.
>
> I welcome an alternative approach if you have any ideas.
Did all tests pass, in particular `TestSoftMaxHeapSize`? The test now happens earlier. I am not sure why the value itself isn't available before, like you say. I am guessing you want to check the value after whatever adjustments have been made in `initialize()`? The value of the flag should be available already, irrespective of when the constraints check is done.
enum class JVMFlagConstraintPhase : char {
// Will be validated during argument processing (Arguments::parse_argument).
AtParse = 0,
// Will be validated inside Threads::create_vm(), right after Arguments::apply_ergo().
AfterErgo = 1,
// Will be validated inside universe_init(), right after Metaspace::global_initialize().
AfterMemoryInit = 2
};
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26867#discussion_r2414911580
More information about the shenandoah-dev
mailing list