My question is related to Java finalize : How can I free non-GC resource even if there's mistake .
The
finalize
is NOT always called in most Garbage Collectors? If so, Why not? and Is there any GC that guarantee callfinalize
before program is normally exit?I use boehm-gc in some project. Does boehm-gc guarantee call
finalize
before program is normally exit? If not, Is there any way to callfinalize
when program is normally exit? (so to speak, callGC_gcollect
beforemain
returns.)