Foreign.StablePtr: nullPtr & double-free questions.

Edward Z. Yang ezyang at MIT.EDU
Wed Mar 13 21:17:03 CET 2013

Excerpts from Remi Turk's message of Wed Mar 13 13:09:18 -0700 2013:
> Thanks for your quick reply. Could you elaborate on what "a bit of
> overhead" means?
> As a bit of context, I'm working on a small library for working with
> (im)mutable extendable
> tuples/records based on Storable and ForeignPtr, and I'm using
> StablePtr's as back-references
> to Haskell-land. Would you expect StablePtr's to have serious
> performance implications
> in such a scenario compared to, say, an IORef?

Yes, they will. Every stable pointer that is active has to be stuffed
into a giant array, and the entire array must be traversed during every
GC.  See also:


More information about the FFI mailing list