[Haskell-cafe] Space leak - help needed

Justin Bailey jgbailey at gmail.com
Wed Mar 12 15:34:38 EDT 2008

On Wed, Mar 12, 2008 at 12:12 PM, Krzysztof Kościuszkiewicz
<k.kosciuszkiewicz at gmail.com> wrote:
>  I have tried both Poly.StateLazy and Poly.State and they work quite well
>  - at least the space leak is eliminated. Now evaluation of the parser
>  state blows the stack...
>  The code is at http://hpaste.org/6310
>  Thanks in advance,

The stack blows up when a bunch of unevaluated thunks build up, and
you try to evaluate them. One way to determine where those thunks are
getting built is to use GHCs "retainer" profiling. Retainer sets will
show you the "call stack" that is holding on to memory. That can give
you a clue where these thunks are being created. To get finer-grained
results, annotate your code with {#- SCC "..." #-} pragmas. Then you
can filter the retainer profile by those annotations. That will help
you determine where in a given function the thunks are being created.

If you need help with profiling basics, feel free to ask.


More information about the Haskell-Cafe mailing list