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