I would like to know if it is possible to know which objects are being garbage collected using dynatrace 6.5. Method Object.finalize() gets called whenever an object is about to get garbage collected. So that will give me some insight on which object are about to be collected. I tried creating a sensor on java.lang.Object.finalize(), and set it to active and start PurePaths, however, I dont see a pure path related to Object.finalize() invocation. I checked the sensors placed on the JVM and it (Object.finalize()) is not coming up. Not sure if dynatrace allows instrumentation on the Object class. Or is there another way to see what objects are being collected by GC using DT. I am familiar with other GC metrics such as GC activation, heap usage, GC time, etc. Thanks
There is a global exclude on all Object methods in the "Java Method Invocation" Sensor Pack. You can only see this Sensor Pack when in debug mode. Perhaps you can edit/unplace it if you really want to instrument Object.finalize(), but I would be careful to insure it doesn't result in over instrumentation.
Continuing what Dave said: I think it would be a bad idea to instrument Object.finalize(). The global exclude is there for a reason. I would instead ask why you want to track when objects are GCed. I think there's better ways to investigate heap issues, but I'd suggest starting back at the original problem. Can you share what drives you in this direction?
Thanks for the reply Joseph and Dave.
The reason I would like to know which objects are GCed is because I would like to see/understand how the GC is behaving, something like "physically" see how the GC is marks object to move it from one generation to another and how objects not being referenced at all are GCed. I have seen GC going for X minutes and I would like to have some insight on why GC is going for X minutes. Moreover, see which objects being GCed are jus taking time to get collected or if the allocated GC threads are not available at the time and at some point it becomes available. Dynatrace will allow me to see the different generations in the heap, but I would like to know how the objects are aging on all these spaces/generations (which objects are aging/being removed). In a nut shell, visually see the JVM heap and which objects are removed/marked/moved on all these heap generations.