[Haskell-cafe] FPS: Finalizers not running (was Memory usage
outside of the Haskell heap)
joelr1 at gmail.com
Sun Nov 6 09:29:05 EST 2005
I followed your suggestion and I think the finalizers for FPS are not
Please take a look at http://wagerlabs.com/Bar.hs to see what I mean.
I had to modify the FPS export list to expose the constructor but
that's the only change I made.
The other useful tidbits are:
-- (internal) GC wrapper of mallocForeignPtrArray
mallocForeignPtr :: Int -> IO (ForeignPtr Word8)
mallocForeignPtr l = when (l > 1000000) performGC >>
createPS :: Int -> (Ptr Word8 -> IO ()) -> FastString
createPS l write_ptr = unsafePerformIO $ do
fp <- mallocForeignPtr l
withForeignPtr fp $ \p -> write_ptr p
return $ PS fp 0 l
I replaced mallocForeignPtr with a call to mallocForeignBytes but
that did not make a difference, the finalizers still don't run.
On Nov 5, 2005, at 4:57 PM, David Roundy wrote:
> You can attach a print message to the finalizer and also print a
> out when creating the string. I've found this to be helpful at times.
More information about the Haskell-Cafe