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.
Message:
Setting References to Null
Posted by Akin Kaldiroglu on 05 Apr 1999, 8:06 AM
I am using JDK 2.0 and when I set an object to null, system does automatically call GC and run finalize() method on that object. It does this after about 1 minute. But as you know this behavior might be particular to the GC mechanism of JVM in JDK 1.2. > If I know that will no longer be using an object, does the > setting of member variable references to null faciliate > garbage collection in any way? For example if I know that I am > done with Object A and A implements a dispose() method that > "cleans up" or sets all references to null, does this impact > garbage collection in any way? Based upon my reading I would > think it would be difficult, if not impossible, to know if this > really has any impact on GC - since each VM may implement GC > differently. > TIA > Brian
Replies:
|