RFR: JDK-8293114: JVM should trim the native heap [v9]

Thomas Stuefe stuefe at openjdk.org
Fri Jul 14 05:39:12 UTC 2023


On Thu, 13 Jul 2023 18:51:09 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Want to replace "Native heap trimmer" with "Periodic native heap trimmer" too? Would be clear that we are suspending only the periodic one. The DCmd command would still be accepted and acted upon. Thinking about it, maybe we should do a follow-up PR and just forward that request to this thread? If so, we don't need to rename it to "Periodic".

I had initially considered it and then avoided since it would add too much unnecessary complexity. E.g., you then would have to start the native trimmer thread even if periodic trimming is off in the off-chance that someone may want to issue a trim from outside. Or, you'd need to start the trimmer thread delayed and on-demand if someone issues a dcmd; then you need to deal with the fact that the trimmer thread may or may not be there. 

Another issue then would be whether trimming would expedite the current trim, aka restart the interval timer, or be additive to the periodic trim. 

My first solution did all that, and it was a lot more complex. I like the simplicity of this patch. Customers issuing trims concurrently via dcmd will hopefully be a very rare occurrence - all those folks that used to issue the dcmd scripted every second hopefully will just switch to the periodic trimming.

Idk. Its all solvable, its just code I guess. Maybe for a later RFE? Integrating the dcmd with periodic trimming may have one pro, that is preventing customers from shooting themselves in the foot who issue the dcmd via script and then forgot they did that :-P

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

PR Comment: https://git.openjdk.org/jdk/pull/14781#issuecomment-1635301221


More information about the serviceability-dev mailing list