Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find out if objects have been garbage collected?

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
US
i'm creating thousands of objects within a tree structure. at one point, i choose a child of the root to be the new root. here's the process, in a nutshell...

newRoot = root.favoredChild;
newRoot.parent = null;
root = newRoot;

i seem to be running out of memory, though, which leads me to believe that somehow a lot of these objects are not becoming garbage collected, and i'd like to find out whether or not they are; then, if they're not, i'd like to find out why not. is there a good way of finding this out?

Liam Morley
lmorley@wpi.edu
"light the deep, and bring silence to the world.
light the world, and bring depth to the silence."
 
finalize() will be called by the garbage collector on an object when garbage collection determines that there are no more references to the object. you may implement finalize() to print out what object is being garbage collected.

 
good idea, thanks. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top