RFR: JDK-8297958: NMT: Display peak values [v4]

Stefan Johansson sjohanss at openjdk.org
Tue Dec 6 15:32:17 UTC 2022


On Tue, 6 Dec 2022 15:05:09 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> What it the reason for omitting the `mtChunk` count?
>
> Oh good catch.
> 
> I think this has to do with this ugly hack in MallocMemorySnapshot::make_adjustment():
> 
> So, we account chunks with mtChunk. Easy. But we also account for arenas. Arenas consists of chunks. To not report memory twice (once under malloced-with-mtChunk, once as "arena") we decrease the malloc size of mtChunk by the combined arena size of all arenas. What's left should be malloc size of free chunks in the free pool.
> 
> But that adjustment messes up the mtChunk malloc counter, since it is implemented as one gigantic free. So the counter is garbage.
> 
> I'll think of something.

Thanks for the explanation. I guess the easy fix is just:

const size_t count = (flag == mtChunk) ? 0 : c->count();

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

PR: https://git.openjdk.org/jdk/pull/11497


More information about the hotspot-runtime-dev mailing list