Will an object declared in method subject to garbage collection?
Posted
by SiLent SoNG
on Stack Overflow
See other posts from Stack Overflow
or by SiLent SoNG
Published on 2010-03-20T09:47:28Z
Indexed on
2010/03/20
9:51 UTC
Read the original article
Hit count: 178
Consider an object declared in a method:
public void foo() {
Object obj = new Object();
// A long run job that consumes tons of memory and
// triggers garbage collection
}
Is obj subject to garbage collection?
© Stack Overflow or respective owner