On Sat, 28 Oct 2023 13:04:05 GMT, Thomas Stuefe <[email protected]> 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 Hi Thomas, Did another run through. I haven't looked at `CachedNMTInformation` in depth yet. src/hotspot/os/linux/memMapPrinter_linux.cpp line 79: > 77: void MemMapPrinter::pd_iterate_all_mappings(MappingPrintClosure& closure) > { > 78: FILE* f = os::fopen("/proc/self/maps", "r"); > 79: if (f != nullptr) { Suggestion: `if (f == nullptr) return;`, reduces indentation for main body of code. src/hotspot/os/linux/memMapPrinter_linux.cpp line 80: > 78: FILE* f = os::fopen("/proc/self/maps", "r"); > 79: if (f != nullptr) { > 80: static constexpr size_t linesize = sizeof(ProcMapsInfo); Make this `constexpr const`, remove `static`. src/hotspot/os/linux/memMapPrinter_linux.cpp line 82: > 80: static constexpr size_t linesize = sizeof(ProcMapsInfo); > 81: char line[linesize]; > 82: while(fgets(line, sizeof(line), f) == line) { Style: space between `while` and `(`. test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java line 3: > 1: /* > 2: * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. > 3: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. Copyright Redhat ------------- PR Review: https://git.openjdk.org/jdk/pull/16301#pullrequestreview-1703761626 PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1375986785 PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1375988375 PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1375987037 PR Review Comment: https://git.openjdk.org/jdk/pull/16301#discussion_r1375994689
