[Haskell-cafe] Memory usage outside of the Haskell heap

David Roundy droundy at abridgegame.org
Sat Nov 5 11:57:13 EST 2005


On Sat, Nov 05, 2005 at 12:18:04PM +0000, Joel Reymont wrote:
> How can I profile memory usage outside of the Haskell heap? I'm using  
> FastStrings for everything and some folks on #haskell suspect it  
> might be causing my problems.
> 
> hGet :: Handle -> Int -> IO FastString
> hGet _ 0 = return empty
> hGet h i = do fp <- mallocForeignPtr i
>               l  <- withForeignPtr fp $ \p-> hGetBuf h p i
>               return $ PS fp 0 l
> 
> 
> I do this a lot and the finalizers might not be running or something  
> like that.

You can attach a print message to the finalizer and also print a message
out when creating the string.  I've found this to be helpful at times.
-- 
David Roundy
http://www.darcs.net


More information about the Haskell-Cafe mailing list