Tracking size of object in JVM

Hi How do i find out which objects are taking memory in JVM.
[74 byte] By [BabuSundarama] at [2007-11-27 9:04:55]
# 1
Try using some kind of profiler, simply JConsole or advanced one line JProbe or OptimizeIt
veechanda at 2007-7-12 21:38:29 > top of Java-index,Core,Monitoring & Management...
# 2

Get a heap dump in HPROF binary format using jmap or the new HotSpotDiagnostic MBean through JConsole if your Java application is running on JDK 6 and then analyze it with the jhat tool in JDK 6 or the new HeapWalker in NetBeans 6. NetBeans 6 can also be used to get a heap dump.

For more detailed info have a look at the Hands-On Lab I presented at JavaOne 2007 about troubleshooting Java applications:

http://developers.sun.com/learning/javaoneonline/sessions/hol2007/1420/jmxjconsole/index.html#Exercise_2_5

Regards,

Luis-Miguel Alventosa

Java SE JMX/JConsole development team

Sun Microsystems, Inc.

http://blogs.sun.com/lmalventosa/

lmalventa at 2007-7-12 21:38:29 > top of Java-index,Core,Monitoring & Management...
# 3

Hi lmalvent,

Thanks for your e-mail.

I heard about HPROF binary format and jmap tool in JDK6. Is it possible to use 100% pure java to track the size of objects in JVM. I use java interactive profiler (JIP) to track CPU usage of methods in a thread. Similarly, i want to see how objects in an applications uses memory in JVM.

Is this possible?

BabuSundarama at 2007-7-12 21:38:29 > top of Java-index,Core,Monitoring & Management...