It's not a secret anymore!
The moose likes Java in General and the fly likes Active objects in the JVM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Active objects in the JVM" Watch "Active objects in the JVM" New topic

Active objects in the JVM

Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Just out of curiosity is there any way to find out the number of object that have references pointing to it in the JVM ? I am not looking for a programmatic solution. Just an API which can be queried to return a number. Does something like this exist ?

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Srinivas Kalvala
Ranch Hand

Joined: Oct 20, 2005
Posts: 257


Have look at following classes, & JCONSOLE uses this,

The JCONSOLE will perform,

� Uptime: how long the JVM has been running
� Total compile time: the amount of time spent in runtime compilation
� Process CPU time: the total amount of CPU time consumed by the JVM
� Current heap size: Number of Kbytes currently occupied by the heap
� Committed memory: Total amount of memory allocated for use by the heap
� Maximum heap size: Maximum number of Kbytes occupied by the heap
� Objects pending for finalization: Number of objects pending for finalization
� Garbage collector information: Information on GC, including the garbage collector names,
number of collections performed, and total time spent performing GC
� Live threads: Current number of live daemon threads plus non-daemon threads
� Peak: Highest number of live threads since JVM started
� Daemon threads: Current number of live daemon threads
� Total started: Total number of threads started since the JVM started (including daemon,
non-daemon, and terminated)
� Current classes loaded: Number of classes currently loaded into memory
� Total classes loaded: Total number of classes loaded into memory since the JVM started,
including those subsequently unloaded
� Total classes unloaded: Number of classes unloaded from memory since the JVM started
Operating System
� Total physical memory: Amount of random-access memory (RAM) that the machine has.
� Free physical memory: Amount of free RAM the machine has.
� Committed virtual memory: Amount of virtual memory guaranteed to be available to the
running process.

Just have a hands on work.
I agree. Here's the link:
subject: Active objects in the JVM
It's not a secret anymore!