Arne said:
It clutters code and does not improve performance
(in 99% of cases).
I am not the right person to explain GC.
But read:
Effective Java / Bloch - item 5.
or read the long thread at:
http://www.theserverside.com/news/thread.tss?thread_id=36362
It is worth noting that there are special cases where it do
improve performance, but those are the exceptions.
It is indeed bad practice to add ANY statement to a program unless it is
going to do some good.
I don't see why assigning null to a reference variable should be singled
out as being bad practice, rather that just falling under the general
rule of avoiding useless code. I have found it to be an effective
technique for reducing memory footprint under the following conditions:
1. The reference variable or array element itself has a long lifetime.
Don't do it for a local variable just before the method containing it
returns.
2. It may be the last reference to the data structure. The payoff is for
making some object or objects unreachable, so that GC can take them away.
3. The data structure is large enough to care about.
Patricia