In the following code:
void method() {
HeavyObject heavy = new HeavyObject();
doStuffWith(heavy);
doOtherStuff();
}
...can heavy
be garbage collected before or during doOtherStuff()
? JLS references preferred, though actual experiments would be cool too.
My goal is to determine whether or not heavy = null
is strictly useless, or might conceivably have some benefit.