Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249667

Enhance NMT stacktraces for Unsafe_AllocateMemory

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 11, 17, 21, 22
    • hotspot

      If a VM was started with -XX:NativeMemoryTracking=detail, jcmd <pid> VM.native_memory detail can be used to get detailed allocation statistics with stack traces of the allocation sites like for example:

      [0x00007ffff6c821b9] SymbolTable::initialize_symbols(int)+0x69
      [0x00007ffff6cfa50d] universe_init()+0x31d
      [0x00007ffff6768457] init_globals()+0x57
      [0x00007ffff6cd2057] Threads::create_vm(JavaVMInitArgs*, bool*)+0x357
                                   (malloc=360KB type=Arena Chunk #1)

      However, NMT currently only captures native stack traces (by design) which means that all allocations going through Unsafe_AllocateMemory will only show up with a single stack frame:

      [0x00007ffff6cfc86b] Unsafe_AllocateMemory0+0xdb
      [0x00007fffd8514950]
                                   (malloc=2048KB type=Other #2)

      This is a pity, because all allocations for direct byte buffers take this allocation path but can't be attributed to a meaningful allocation site.

      Investigate a possibility to enhance these stack traces. Take a look if we can't leverage something like `VMError::print_native_stack()` or `AsyncGetCallTrace()` to get mixed stack traces in NMT?

            Unassigned Unassigned
            simonis Volker Simonis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: