Is it possible to define such malloc and free that their data will be managed by GHC runtime?

Viewed 62

I have a source-distributed third-party library written in C, and I want to integrate it into a haskell project. This library is a minefield of contrived memory management (some functions take ownership of pointers, some don't), so I would like to not do it myself.

This library provides an option of defining custom malloc and free functions. I was wondering if I could have something similar to Boehm GC, but for GHC runtime. Does something like that exist? Is it even possible to implement since GHC gc relies on immutability?

0 Answers
Related