[Haskell-cafe] FPS lib

Krasimir Angelov kr.angelov at gmail.com
Tue Oct 18 07:39:33 EDT 2005


   ForeignPtr requires more memory. Each ForeignPtr has
ForeignPtrContents structure attached. In the ForeignPtrContents there
is one IORef. Each finalizer adds one Weak# object in the heap. The
IORef is a reference to a list of finalizers, so each new finalizer
adds a new CONS cell. The finalizers require additional steps in GC
time. I haven't tried to measure the difference between ForeignPtr and
ByteArray# based implementations but it seems to me that the latter
might be better. Of course it will be GHC specific.
   mmap is valuable only for large string. Typically only when someone
wants to read the entire file in the memory. For this case a special
data structure might be provided.

Cheers,
   Krasimir


More information about the Haskell-Cafe mailing list