Will this be garbage collected in JVM?

Posted by stjowa on Stack Overflow See other posts from Stack Overflow or by stjowa
Published on 2010-06-17T13:59:56Z Indexed on 2010/06/17 14:03 UTC
Read the original article Hit count: 171

I am running the following code every two minutes via a Timer:

object = new Object(this);

Potentially, this is a lot of objects being created and a lot of objects being overwritten. Do the overwritten objects get garbage collected, even with a reference to itself being used in the newly created object?

I am using JDK 1.6.0_13.

Thanks for the help.

© Stack Overflow or respective owner

Related posts about java

Related posts about best-practices