The Artima Developer Community
Sponsored Link

Garbage Collection and innerclass



This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Garbage Collection and innerclass

Posted by Viru Hugar on 03 Jun 1998, 1:28 PM

Suppose there is object A holding reference to another
object B's innerclass instance, say X. Now assign B to null.
Inner classe instance X does not reference any variables of B.

I thought B should be garbage collected because nobody is
using this.

I tested it and found that SUN's JVM doesn't gc object B.

What's your take on this?

  • A, B, X Bill Venners 03 Jun 1998, 1:50 PM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us