Hi,
I am working on a project of visualizing the HotSpot heap. It is basically a GCSpy rewrite and I am trying o write a HotSpot driver. Just very quickly what the tool is providing - set of tiles per every heap space (young, old and permanent generation), where every tile has a well defined size (let's say 64kB). The visualization is then defined by the color of every tile (the white means tile is absolutely free of objects and 100% red tile means the whole tile is used by objects). To do that, I need 3 information: 1. object size - how many bytes every object consumes in memory (not recursive/deep size) 2. object address - to compute the heap fragmentation, I need to know the address of object (when using together with size, I should know the exact part of heap occupied by every object) 3. heap spaces - what heap spaces are used and their addresses as well (to know what object belongs to what heap space) I spend quite a lot of time trying to figure out how can we get those information and there is a way to get all of them, however I need some interactions of APIs: 1. object size - can by determined by Java Agent, native agent, JVMTI and serviceability agent as well 2. object address - the only way I found is by using the Serviceability agent 3. heap spaces - again just Serviceability agent seems like having such a capability Now the idea is to use JVMTI and Serviceability agent together. JVMTI will call callbacks every time object is allocated (for "new" object allocation bytecode instrumentationwill be used), deallocated or GC was finished and the size and address information will be determined by Serviceability Agent. For performance reasons it will be super inefficient to iterate through the whole heap every time JVMTI generates callback. Well, the problem is that even if I get notifications from JVMTI, I cannot determine the address of object from JVMTI, so I don't know how to map the identity of object from JVMTI to Serviceability agent. So I should be able to just update the part of heap that is really needed to be updated instead of whole heap and I have no idea how this could be achieved. Do you have any idea how could I get the object address and heap spaces from JVMTI, or the callbacks (JVMTI callbacks like objectAlloc(), GCFinished(), ...) from Serviceability agent, or how to connect those APIs to work together? Thanks very much, Martin Skurla