RFR: 8334026: Provide a diagnostic PrintMemoryMapAtExit switch on Linux

David Holmes dholmes at openjdk.org
Fri Jun 14 04:48:17 UTC 2024


On Tue, 11 Jun 2024 14:01:27 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> To investigate footprint problems of processes with a short lifespan (e.g. startup footprint problems), we found it very useful to be able to get an annotated memory map at exit - the same map printed by jcmd System.map.

Seems quite reasonable. One query and a couple of minor nits.

Thanks

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

> 205: static void print_thread_details_for_supposed_stack_address(const void* from, const void* to, outputStream* st) {
> 206: 
> 207:   ResourceMark rm;

Why was this needed to be added here? Shouldn't callers have any needed ResourceMarks?

test/hotspot/jtreg/runtime/NMT/PrintMemoryMapAtExitTest.java line 43:

> 41:         ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
> 42:       "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintMemoryMapAtExit",
> 43:                 "-XX:NativeMemoryTracking=summary", "-version");

Nit: indentation is off here.

test/hotspot/jtreg/runtime/NMT/PrintMemoryMapAtExitTest.java line 48:

> 46:         output.shouldContain("Memory mappings");
> 47:         output.shouldContain("JAVAHEAP");
> 48:         output.shouldHaveExitValue(0);

Suggestion: check the exit value first. If we crashed then the other checks will likely fail before we get here.

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

PR Review: https://git.openjdk.org/jdk/pull/19660#pullrequestreview-2117450922
PR Review Comment: https://git.openjdk.org/jdk/pull/19660#discussion_r1639248294
PR Review Comment: https://git.openjdk.org/jdk/pull/19660#discussion_r1639244620
PR Review Comment: https://git.openjdk.org/jdk/pull/19660#discussion_r1639245697


More information about the hotspot-runtime-dev mailing list