1

Possible Duplicate:
Reference to object during finalize

I have an Object which is eligible for garbage collection, but within its finalize method, I save a reference to that Object, say by calling arrayList.add(this).

Will the object still get garbage collected?

Community
  • 1
  • 1
Jai Pandit
  • 510
  • 1
  • 6
  • 18

1 Answers1

0

The short answer is: No. The long answer is: Yes. The first time the finalize method is called it will "resurrect", however, when the variable becomes eligible for GC again, the finalize method will not be called and it will be GC'ed.

Mitch Connor
  • 766
  • 10
  • 19