• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"Number Of Objects in Heap"

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do i find the number of objects currently placed in the heap?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
subhadeep chakraborty
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic