Profile Image
Ramesh S

DirectByteBuffer analysis on Windows machine

Hi, 

I came across async-profiler which helps to analyze Unsafe.allocatememory calls happening in context of DirectByteBuffer and drill down who are the callers, using the flamegraph output.

 

Unfortunately async-profiler doesn't support Windows, since Windows lacks few aspects which linux provides.

 

How do I go about analyzing the native memory requests which are happening , for example, off-heap analysis.

I tried using Native Memory Tracking, but this tool only focuses on JVM usage of offheap memory and not any third party libraries.

But our application uses third party libraries which internally uses DirectByteBuffers.

I have inspected with MBeans the amount of direct buffer memory used, but this piece of information doesn't give me any idea what's happening below the hood, especially for Windows.

I have started using ProcessExplorer, VMMap, but honestly I am just getting started, so if someone has already experienced in this area, with Windows, how to analyze the issue, basically I want to find out and optimize the usage of off-heap by 3rd party libraries, in Windows environment,

 

 

  • offheap

  • windows

  • visualvm

  • directbytebuffer

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Ramesh!

 

 Good question. I don't have a direct answer, however here are some of my thoughts:

 

1. Simulate the Problem in Linux Environment: You can simulate the problem in Linux Environment and then use the async-profiler. 

 

2. OutOfMemoryError: Are you experieincing 'OutOfMemoryError: Direct buffer memory', if so you can follow the steps outlined in this post: Java OutOfMemoryError: Direct buffer memory

 

3. Switching from Spring RestTemplate to WebClient: Spring Boot is a popular framework for Java enterprise applications. One common method of integration with internal or external applications is through RestTemplate APIs. Modern versions of Spring advocate to use Java NIO-based WebClient for better performance. While NIO based Webclient delivers better performance, it shifts the objects creation from the heap memory region to the Direct Buffer region. Thus when you make this shift, it will result in memory pressures in the Direct Buffer region. Did you make any such upgrades/shifts recently?

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • offheap

  • windows

  • visualvm

  • directbytebuffer