[Haskell-cafe] Space leaks

Luke Palmer lrpalmer at gmail.com
Thu Jul 17 14:58:52 EDT 2008


On Thu, Jul 17, 2008 at 12:14 PM, Peter Gavin <pgavin at gmail.com> wrote:
> 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 throughout.

I don't know what I can suggest as for general tactics.  Without
seeing the code it's hard to say what could be happening.  Just
remember that strictness is not always the answer!

>From the very limited amount of information I got from this
description, my first guess would be the data structure itself, or the
functions inside it.  If it's lazily generated, then you might not be
seeing the full amount of space it's taking up at once.  But that's
just a guess.

Luke


More information about the Haskell-Cafe mailing list