File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark ""Number Of Objects in Heap"" Watch ""Number Of Objects in Heap"" New topic
Author

"Number Of Objects in Heap"

subhadeep chakraborty
Ranch Hand

Joined: Jul 29, 2006
Posts: 67
How do i find the number of objects currently placed in the heap?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
In an ordinary Java application, you can't.

Using the monitoring/debugging APIs, you can, but I am no expert in using those. Alternatively, you can use a profiler/monitor program. Certainly, JProfiler would tell you. I think some of Sun's free tools will, too.

For what purpose do you need this information?
[ August 23, 2007: Message edited by: Peter Chase ]

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
subhadeep chakraborty
Ranch Hand

Joined: Jul 29, 2006
Posts: 67
i am new to java and i am not using it so, it would be helpful if you could tell some easy way to find.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
In general, there is no easy way to get this info, and you don't need it.

If you really want the answer anyway, the easiest way is probably to find an IDE or profiler that gives you this information. Personally I've never had any reason to track down that info, so I can't help you there.

But again, in all likelihood, you really don't need it.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Number Of Objects in Heap"