RFR: 8369527: NMT: print malloc-site when a malloc'd memory detected as corrupted [v2]

David Holmes dholmes at openjdk.org
Tue Oct 14 04:03:02 UTC 2025


On Mon, 13 Oct 2025 17:22:15 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> On NMT detail mode, the allocation-sites of malloc'd memory regions are also stored. Using this information, the call-stack of a corrupted memory can also be printed as the error message.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   return nullptr when index is invalid

This seems reasonable to me.

What does the output look like?

Thanks

test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp line 173:

> 171:   const size_t SIZE = 1024;
> 172:   char* p = (char*)os::malloc(SIZE, mtTest);
> 173:   *(p -1) = 0;

Suggestion:

  *(p - 1) = 0;

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27764#pullrequestreview-3333820717
PR Review Comment: https://git.openjdk.org/jdk/pull/27764#discussion_r2427849031


More information about the hotspot-runtime-dev mailing list