Reputation: 75237
I don't exactly remember but there was an article for Java that explains variable modifiers that makes them prone to be collected by garbage collector. Is there any mechanism for Java to define variables as stepped to be collecting by garbage collector?
Upvotes: 1
Views: 65
Reputation: 9182
I think you were referring to the finalize keyword. Do take note that this only makes the suggestion to the compiler. The compiler may choose not to garbage collect. Or perhaps you were referring to weak references...
Upvotes: 0
Reputation: 3057
What you're looking for might be Weak Reference, have a look here: http://en.wikipedia.org/wiki/Weak_reference
Upvotes: 1
Reputation: 24895
If an object is referenced (directly or indirectly) by a variable, it won't be collected at all.
Apart from that, there is nothing. Garbage collector is a black box and just does what it fits (even System.gc() is only a suggestion to run the garbage collection).
Upvotes: 0