JVMTI-enabled heap allocation tracking

By writing profiling, I would also perform the typical task of profiling a heap. In particular, I would like to track which thread allocated how much data? Using JVMTI, I thought it’s enough to connect to the VM Object Allocation and Object Free events. Unfortunately, I read that the first event does not fire due to calls made to new.

The last idea that I had was to check the MethodExit event if its name <init>and thus declare this call as an object distribution. However, in this event, I cannot receive the object, and therefore I cannot call GetObjectSize.

A simple repetition over a heap does not contain information about which object was selected by the stream. Does anyone have an idea how to implement this?

+3
source share
3 answers

Is there a reason why you cannot call GetObjectSizefrom an event MethodEntryfor a constructor?

If you are interested in executing the code before returning the method, you can listen to the event MethodEntry, and if the method is called <init>, you can call the event for the current frame NotifyFramePopto listen FramePop. This event is similar to an event MethodExit, but occurs before the method returns, so you can get the object this.

+2
source

Hotspot VM (templateTable_x86_64.cpp), -, , _new JVMTI ( ). , , , JVMTI.

, Hotspot VM ?

+2

All Articles