On 21 Jan 2016, at 2:56 , Ben Coman btc@openInWorld.com wrote:
btw, only slightly off topic... I just read something very interesting about using the host** finalization and garbage collector to free guest** malloc'd memory to reduce memory leak. Scroll down to "Memory management: let the garbage collector do the work" http://book.realworldhaskell.org/read/interfacing-with-c-the-ffi.html http://book.realworldhaskell.org/read/interfacing-with-c-the-ffi.html (**are these reaonble terms to use here?) Note: I don't actually know Haskell. I only got distracted and bumped into this while looking for other info.
Lua seems to have something similar... cdata = ffi.gc(cdata, finalizer) http://luajit.org/ext_ffi_api.html http://luajit.org/ext_ffi_api.html
https://wiki.haskell.org/HSFFIG/Tutorial https://wiki.haskell.org/HSFFIG/Tutorial
- 4.1 Naming conventions
https://wiki.haskell.org/GHC/Using_the_FFI https://wiki.haskell.org/GHC/Using_the_FFI
http://luajit.org/ext_ffi_api.html http://luajit.org/ext_ffi_api.html
https://colberg.org/gcc-lua-cdecl/ffi-cdecl.html https://colberg.org/gcc-lua-cdecl/ffi-cdecl.html
NB-FFI does this too, see NBExternalResourceExecutor.
Cheers, Henry