[Haskell-cafe] ForeignPtr and Garbage Collection

2013-07-30 Thread satvik chauhan
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

Re: [Haskell-cafe] ForeignPtr and Garbage Collection

2013-07-30 Thread Matt Cox
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