File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Visualization of  Heap Memory In java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Visualization of  Heap Memory In java" Watch "Visualization of  Heap Memory In java" New topic

Visualization of Heap Memory In java

Rajesh Tarte
Ranch Hand

Joined: Nov 02, 2006
Posts: 33

Is there any way to see how many objects are created in/on Heap memory in java

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

The JVM has APIs for debugging and profiling, and the current version of Sun Java 6 includes a nice tool called JVisualVM which can show you a lot of information about what's happening in running Java programs. It can show exactly how much memory running Java programs are using, for example. I don't know if it can show exactly how many objects of what types are created, but maybe it can. You should be able to start this tool by typing in "jvisualvm" in a command prompt window.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Rajesh Tarte
Ranch Hand

Joined: Nov 02, 2006
Posts: 33

Does same kind of functionality available in 1.5

Ashutosh Gawande

Joined: Aug 19, 2009
Posts: 11

You can use Jmap for creating the memory dump by providing the process id for java process which is running your program and then you can use eclipse memory analyser tool/plug-in to analyse the memory dump.
This will give you all the details you are looking for. But you will need to have patience in analysing dump and need to understand how to spot an issue.

I agree. Here's the link:
subject: Visualization of Heap Memory In java
It's not a secret anymore!