[Haskell-cafe] Space leaks

Peter Gavin pgavin at gmail.com
Thu Jul 17 14:14:02 EDT 2008

Hello everyone,

I have this piece of code I've been working on, and I've been stuck on 
tracking down a space leak in it for some time now.  The code is 
essentially a tight loop that updates a rather largish data structure 
with embedded functions that are called by the driver loop.  The code 
doesn't accumulate any data as the loop runs (at least deliberately), so 
I would expect the memory profile to be flat.  Unfortunately, the 
profile is a wedge :)   I've added bangs and `seq` literally everywhere, 
and it looks (to me at least) like there's nothing left to be lazily 
evaluated anywhere.  I've used retainer profiling, and the functions 
that are leaking space according to the profiler output are strict 

I'm really pulling my hair out over this, but I'm reluctant to publish 
the code just yet because I'm planning on using it (eventually) for my 
thesis. It seems like I've just about run out of options, though.

Does anyone have any advice on tracking down space leaks?  I don't want 
to accuse GHC of having a bug just yet, but has GHC had space leak bugs 
in the past?

Thanks in advance,
Peter Gavin
<gavin at cs.fsu.edu>

More information about the Haskell-Cafe mailing list