RFR: JDK-8269571: NMT should print total malloc bytes and invocation count

Xin Liu xliu at openjdk.java.net
Tue Jun 29 20:14:05 UTC 2021


On Tue, 29 Jun 2021 07:08:49 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> At the moment NMT prints a total of reserved and committed bytes. If one wants to know how much C-Heap the VM uses, one needs to add all numbers from the sub categories.
> 
> It would be helpful would NMT print the total number of malloced memory and additionally the malloc invocation count.
> 
> ----
> 
> This patch modifes the printout to print, in addition to totals, the number of malloced bytes, malloc invocation counts, and number of mmap reserved/committed bytes. This mirrors the way we print individual sub categories and allocation sites.
> 
> Before:
> 
> Native Memory Tracking:
> 
> Total: reserved=18489703KB, committed=1183967KB
> 
> 
> After:
> 
> 
> Native Memory Tracking:
> 
> Total: reserved=18491726KB, committed=1183178KB
>        malloc: 40590KB #13669
>        mmap:   reserved=18451136KB, committed=1142588KB
> 
> 
> Tests: Ran hotspot/runtime/NMT jtreg tests.

your change looks good to me. 

>        malloc: 40590KB #13669
I think 13669 is the invocation count of malloc(). Out of curiosity, may I know how to use it?  Do you intend to use this to pinpoint memleak from malloc()?  A straight malloc() icount may not help much. Is it possible we can have the number of  unbalanced malloc()?  That is icount of malloc() minus icount of free(). of course, it is not directly related to this PR.

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

PR: https://git.openjdk.java.net/jdk/pull/4622


More information about the hotspot-runtime-dev mailing list