Writing a profiling I would also implement the typical task of heap profiling. Specifically I would like to track, which thread has allocated how much data? Using JVMTI I thought it's sufficient to hook to the events VM Object Allocation and Object Free. Sadly I read the first event is not triggered due to calls made to new
.
The last idea I had was to check teh event MethodExit if its name is <init>
and thus declare this call as an object allocation. However, within this event I cannot get the object and thus I cannot invoke GetObjectSize
.
Simply iterating over the heap, bears no information regarding which object was allocated by which thread. Does anyone have an idea how to implement this?