
Hi, I have some code that uses FFI capabilities to associate previously allocated memory with a structure akin to a ByteArray and allows Haskell land to read and write to the C side of things. I use ForeignPtr and associate a destructor to allow the GHC's garbage collector to clean up after it figures out that the structure is no longer being used. I know I am in funny territory. In some instances (when benchmarking) GHC takes its time getting around to garbage collecting. Can someone suggest hooks to encourage GHC to clean up things? Or better still functions to instruct GHC to garbage collect specific structures (by calling relevant destructors)? Also comments on how safe this whole business is. Before I launch myself into making obscene calls to GHC's internals, I should know what I am dealing with. Cheers Rahul
participants (1)
-
Rahul Bhargava