[Haskell-cafe] Space leak - help needed

Krzysztof Kościuszkiewicz k.kosciuszkiewicz at gmail.com
Thu Mar 13 19:50:25 EDT 2008


On Wed, Mar 12, 2008 at 12:34:38PM -0700, Justin Bailey wrote:

> 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.

I'm not entirely sure if I understand retainer profiling correctly... So
please clarify if you spot any obvious blunders.

Retainers are thunks or objects on stack that keep references to
live objects. All retainers of an object are called the object's
retainer set.  Now when one makes a profiling run, say with ./jobname
+RTS -p -hr, the graph refernces retainer sets from jobname.prof. My
understanding is that it is the total size of all objects retained by
retainer sets being plotted, correct?

About decoding the sets from jobname.prof - for example in

> SET 2 = {<MAIN.SYSTEM>}
> SET 16 = {<Main.CAF>, <MAIN.SYSTEM>}
> SET 18 = {<MAIN.SYSTEM>, <Main.many1,Main.list,Main.expr,Main.CAF>}

{...} means it's a set, and <ccN,...,cc0> is the retainer cost centre
(ccN) and hierarchy of parent cost centres up to the "top level" (cc0)?

My understanding is that SET 18 above refers to objects that are
retained by exactly two specified cost centres, right?

Finally, what is the MAIN.SYSTEM retainer?

Thanks in advance,
-- 
Krzysztof Kościuszkiewicz
Skype: dr.vee,  Gadu: 111851,  Jabber: kokr at jabberpl.org
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci


More information about the Haskell-Cafe mailing list