[Haskell-cafe] Space leaks

Jefferson Heard jefferson.r.heard at gmail.com
Thu Jul 17 16:34:40 EDT 2008

Peter, from 500 feet, we can't see much, but your strictness might
actually be your problem depending on what "largish" looks like and
whether you're reading your data from disc.  It's entirely possible
that your data structure updates or disc reads are head-strict and
you're evaluating or loading the entirety of data in memory at a
single update.

-- Jeff

On Thu, Jul 17, 2008 at 2:58 PM, Luke Palmer <lrpalmer at gmail.com> wrote:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

I try to take things like a crow; war and chaos don't always ruin a
picnic, they just mean you have to be careful what you swallow.

-- Jessica Edwards

More information about the Haskell-Cafe mailing list