Possible duplicate:terminate and exclude a method
The garbage collector calls the method finalize()when the object is about to be freed from memory. What happens when an exception occurs in a method finalize()?
finalize()
Will the GC continue on and free the memory, or will the GC stop the process for this object?
If the exception is expressed in the try-catch statement and correctly caught, then yes, "GC will continue next", as is the case in regular programs.
But if the processed exception is not processed, then, according to JSL ,
, .
, "GC ", , .
, 2 :
, finalize ( )
, , ? , JVM.
( ) GC , , GC. (cf Java Tuning 2nd, Edition Jack Shirazi).
" , finalize, , ". http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#finalize()