addFinalizer to which object? (fwd from cafe)

Henning Thielemann lemming at henning-thielemann.de
Fri Jan 22 10:26:16 EST 2010


On Tue, 19 Jan 2010, Henning Thielemann wrote:

> The documentation of System.Mem.Weak.addFinalizer suggests to me, that this 
> function is very fragile, because the object we track, might be optimized 
> away. ...

After even more web search I found the bytestring-mmap package that 
brought my attention to the module Foreign.Concurrent. This actually 
solves my problem! I would like to have pointers in System.Mem.Weak and 
Foreign.ForeignPtr to this module, otherwise it is very hard to find! The 
function names in this module are so similar to Foreign.ForeignPtr that it 
is likely that you do not even recognize easily that it is actually 
different functionality, not only the same functionality for concurrent 
applications.
  I would also like to read about examples, where 
System.Mem.Weak.addFinalizer can be actually used and does not interfer 
unexpectedly with unboxing. If there is no such example there might be a 
warning like "addFinalizer is certainly not, what you are looking for" or 
a DEPRECATED flag.


More information about the FFI mailing list