I'm trying to write some racket code which interfaces with a foreign
library and provides a safe interface. Some of the functions I'm calling
allocate memory and need to have this explicitly freed by the caller. The
'allocator' binding from ffi/unsafe/alloc seems to solve this problem, but
I'm running into issues using it from places other than the main one. The
issue is that if a place gets shut down then the finalizer that was
registered don't seem to run, and I can observe the leaked memory at the
process level.

I took a look at ffi/unsafe/custodian and it seems that
register-custodian-shutdown would allow this to be implemented. Is there a
reason that such allocator doesn't do this by default?

Code:
https://gist.github.com/endobson/6efdca16885162b51b76ab385e9afa5b

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to