On Sun, 18 May 2025 15:21:37 GMT, Albert Mingkun Yang <[email protected]> wrote:
>> src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 404:
>>
>>> 402: collect_at_safepoint(!should_run_young_gc);
>>> 403:
>>> 404: if (is_gc_overhead_limit_reached()) {
>>
>> Maybe want to adopt current algorithm, start to clear soft references when
>> approaching gc overhead limit?
>> Running a full gc and clearing all soft references without retrying
>> allocation and throws OOM, seems a bit harsh.
>>
>> People still use soft references for caches, reclaim soft references could
>> potentially free large amount of memory.
>
> Revised a bit; the limitation of what we have on master is that it doesn't
> detect gc-overhead for young-gcs. If many young-gcs are run, gc-overhead
> checking should kick in as well.
I wonder if you should try `expand_heap_and_allocate()` under
`_is_heap_almost_full` situation as well. I am afraid that it might throw OOM
before heap is fully expanded again, because compact GC does not expand heap.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25000#discussion_r2107963971