Proposal: On Linux, add option to periodically trim the glibc heap
Thomas Stüfe
thomas.stuefe at gmail.com
Sat Aug 28 06:38:18 UTC 2021
Hi Kim, Remi, Alexey,
thank you for your input. I combine my answers to you in one mail.
I first balked at the idea of tying malloc_trim to the G1 (or to any
singular VM facility which may or may not be active) because I often see
the highest C-heap usage from third-party code, not the VM. To me, a
dedicated independent little facility like the proposed periodic cleaner
seemed to be a better fit.
But thinking about this, the GC is a good fit because its job is to release
unused resources, and it does so periodically. But I would like to add this
to every GC, not just G1. I don't want to have to remember which GC does
the trimming.
Note that Ruby does it too: https://bugs.ruby-lang.org/issues/15667
> +1, I think it would be sensible to shrink the C heap during
> periodic/explicit GCs. This also reuses
> the existing GC timing/logging/tuning facilities.
>
That is a good point.
> --
> Thanks,
> -Aleksey
>
>
I'll analyze this some more, I want to have a better idea about the cost of
trimming, and will prepare a patch.
Thanks, Thomas
More information about the hotspot-dev
mailing list