RFR: 8317453: NMT: Performance benchmarks are needed to measure speed and memory [v10]

Gerard Ziemski gziemski at openjdk.org
Wed May 7 15:15:58 UTC 2025


On Mon, 5 May 2025 13:03:59 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   use permit_forbidden_function for realloc
>
> src/hotspot/share/nmt/mallocTracker.cpp line 170:
> 
>> 168: // Record a malloc memory allocation
>> 169: void* MallocTracker::record_malloc(void* malloc_base, size_t size, MemTag mem_tag,
>> 170:   const NativeCallStack& stack, void* old_base)
> 
> Unused

We are using `old`, you can see it here:


void NMT_MemoryLogRecorder::record_alloc(MemTag mem_tag, size_t requested, void* ptr, const NativeCallStack *stack, void* old) {
  NMT_MemoryLogRecorder *recorder = NMT_MemoryLogRecorder::instance();
  if (!recorder->done()) {
    address old_resolved_ptr = (address)old;
    if (old != nullptr) {
      if (MemTracker::enabled()) {
        old_resolved_ptr = (address)old - NMT_HEADER_SIZE;
      }
    }
    NMT_MemoryLogRecorder::_record(mem_tag, requested, (address)ptr, old_resolved_ptr, stack);
  }
}


It's how we can tell malloc vs realloc.

> src/hotspot/share/nmt/memLogRecorder.hpp line 185:
> 
>> 183: 
>> 184: class NMT_MemoryLogRecorder : public NMT_LogRecorder {
>> 185: public:
> 
> TODOs?

There is a bunch of TODOs for Windows impl. I am hoping we can check it in without Windows support, then add that later?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23786#discussion_r2077887507
PR Review Comment: https://git.openjdk.org/jdk/pull/23786#discussion_r2077891580


More information about the hotspot-dev mailing list