RFR: JDK-8318636: Add jcmd to print annotated process memory map [v6]

Johan Sjölen jsjolen at openjdk.org
Wed Nov 1 10:09:40 UTC 2023


On Sat, 28 Oct 2023 13:04:05 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Analysts and supporters often use /proc/xx/maps to make sense of the memory footprint of a process.
>> 
>> Interpreting the memory map correctly can help when used as a complement to other tools (e.g. NMT). There even exist tools out there that attempt to annotate the process memory map with JVM information.
>> 
>> That, however, can be more accurately done from within the JVM, at least for mappings originating from hotspot. After all, we can correlate the mapping information in NMT with the VMA map.
>> 
>> Example output (from a spring petstore run):
>> 
>> [example_system_map.txt](https://github.com/openjdk/jdk/files/13179054/example_system_map.txt)
>> 
>> This patch adds the VM annotations for VMAs that are *mmaped*. I also have an experimental patch that works with malloc'ed memory, but it is not ready yet for consumption and I leave that part of for now.
>
> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix various builds

OK, went through the cache. Will continue later.

src/hotspot/share/nmt/memMapPrinter.cpp line 105:

> 103:       _ranges[_count - 1].to = to;
> 104:       return true;
> 105:     }

I'm pretty sure that the virtual memory tracker already gives you the minimal set of regions, have you observed this branch being taken?

src/hotspot/share/nmt/memMapPrinter.cpp line 119:

> 117:     assert(_capacity > _count, "Sanity");
> 118:     _ranges[_count].from = from;
> 119:     _ranges[_count].to = to;

Or just `_ranges[_count] = Range{from, to}`

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

PR Review: https://git.openjdk.org/jdk/pull/16301#pullrequestreview-1707901319
PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1378602552
PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1378604692


More information about the serviceability-dev mailing list