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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to