The pointer held in a ForeignPtr is not managed at all by the GC. The ForeignPtr itself is a GC'd object and runs a finalizer (a function receiving a pointer) with the value it holds when it is destroyed.
For example, if you allocate a C resource in one foreign call and then store its value in a foreign pointer, that externally allocated memory it points to is outside the management of the GC. Matt On Tue, Jul 30, 2013 at 9:50 AM, satvik chauhan <mystic.sat...@gmail.com>wrote: > Hi Cafe, > > Is it guaranteed that the value of `ForeignPtr` will not be changed (for > example due to compaction etc) by haskell garbage collector until it goes > out of scope and finalizer is run. > > -Satvik > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe