[RFC 8285277] - How should the JVM handle container memory limits

Thomas Stüfe thomas.stuefe at gmail.com
Thu Apr 28 07:11:27 UTC 2022


>
>
> I think the only thing you could do for the scenario outlined, when the
> VM has no idea what may be running in the container nor how much of the
> container memory it might have available to it, is to provide the "I'm
> running by myself so max out the memory use" flag. But even then
> determining how much slack you need to leave will be difficult given we
> only really have control over some aspects of memory usage.
>
> Trying to pro-actively reduce memory use when you hit some soft limit is
> a good idea, but does such an API exist to let you know when you have
> hit that soft limit?
>
>
How about a slim concurrent thread in a loop observing RSS, comparing with
a pre-set soft limit, and - if the used java heap and the used metaspace
are of any significance (since these are the main things a gc can
influence) - trigger a gc, possibly asynchronously.

Cheers, Thomas


> Cheers,
> David
>
>
>


More information about the hotspot-dev mailing list