Garbage Collector : finalize isn't always called?

122 views Asked by At

My question is related to Java finalize : How can I free non-GC resource even if there's mistake .

  1. The finalize is NOT always called in most Garbage Collectors? If so, Why not? and Is there any GC that guarantee call finalize before program is normally exit?

  2. 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 call finalize when program is normally exit? (so to speak, call GC_gcollect before main returns.)

0

There are 0 answers