RFR: JDK-8296360: Track native memory used by zlib via NMT
Thomas Stuefe
stuefe at openjdk.org
Sun Dec 11 08:11:51 UTC 2022
On Fri, 4 Nov 2022 14:35:00 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> This patch adds NMT tracking to the zlib.
>
> *Please note: we currently discuss whether NMT can be expanded across the JDK in this ML discussion [1]. This PR depends on the outcome of that discussion and won't proceed unless greenlighted. But since [1] is stalled, I post the PR for RFR to get some feedback on the code itself and for people to try it out.*
>
> NMT tracks hotspot native allocations but does not cover the JDK (apart from small exceptions). But the native memory
> footprint of JDK libraries can be very significant. Recently we had a customer whose zlib footprint went into the ~40GB range. We analyzed the problem with an in-house memory tracker, but things would have been a lot simpler using NMT.
>
> This patch instruments the zlib via zalloc hooks, which is minimally invasive. It does not touch zlib sources, so it works with both the bundled zlib and system zlib. All the instrumentation happens in the JVM zlib wrapper.
>
>
> - j.u.zip (deflate) (reserved=624, committed=624)
> (malloc=624 #3)
>
> - j.u.zip (inflate) (reserved=221377904, committed=221377904)
> (malloc=221377904 #60877)
>
> - Zip (other) (reserved=8163446896, committed=8163446896)
> (malloc=8163446896 #182622)
>
>
> [1] https://mail.openjdk.org/pipermail/core-libs-dev/2022-November/096197.html
Withdrawing for now; let's see how our discussion goes.
-------------
PR: https://git.openjdk.org/jdk/pull/10988
More information about the hotspot-dev
mailing list