4 ms·
If you call out to a C-style library through the FFI that's expecting a cleanup call, you should call it in both a user-accessible close() function and the fina
by bcoates 13y ago
If you call out to a C-style library through the FFI that's expecting a cleanup call, you should call it in both a user-accessible close() function and the finalizer.
I think the easiest way to think about it is, "finalizers don't prevent handle leaks, they sometimes clean up a handle leak that already happened".
I'm not sure if any debugger environments give a warning when a finalizer gets run due to GC but they ought to--it always indicates a programmer error.