How long should I expect a garbage collection to take before removing an opaque FFI object? Is it possible to speed it up some way?
问题 I consider writing Haskell bindings to a quantum mechanics library written in C++ (I'd write a plain C wrapper) and CUDA. A major bottleneck is always the GPU memory used by the CUDA parts. In C++, this is handled quite efficiently because all objects have automatic memory management, i.e. are erased as soon as they leave scope. Also I use C++11 move semantics to avoid copies, those obviously wouldn't be necessary in Haskell anyway. Yet I'm concerned it might not work as smoothly anymore when