Listening to heap size changes (original) (raw)

Listening to heap size changes / reallocation

Crazy Java crazyjavahacking at gmail.com
Wed Mar 14 06:45:56 PDT 2012


Hi,

I was searching through the SA source code, but I didn't find a way how could I be notified when the heap (generations, spaces, memregions) will be changed. The point is I am visualizing the HotSpot heap and I have information about all the object sizes and addresses (using some native code and tricks in native agent). Using Serviceability agent I also have information about the heap separation (generations) and their addresses.

So I should be able to visualize the heap. However when objects will be created, there is a possibility of allocating more memory for the heap by the VM (because there could be not enough memory to allocate the object). And so the addresses of heap (let's say young or old generation) could change because of that.

The question is if it is possible to register some kind of listener for that. Or if the already acquired heap representation objects from SA will be automatically updated (I don't think so, but good idea). Or I need to get the heap representation objects every time (for every object allocation seems like total overkill).

I also found a class called MemRegion, maybe this can help?

Thanks very much, Martin Skurla -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20120314/68406132/attachment.html



More information about the serviceability-dev mailing list