Improving cost center reports to show residency?

Edward Z. Yang ezyang at
Mon Aug 8 19:02:20 UTC 2016

Hello Omer,

I don't quite understand; is +RTS -hc what you want?  That will output
a heap profile per cost center, which will give you residency.  Is the
problem that you need a heap profile every minor GC rather than major
GC (e.g. something like ?)


Excerpts from Ömer Sinan Ağacan's message of 2016-08-08 11:28:48 +0000:
> One thing that we can't currently see in cost center reports is the residency
> and because of that cost centers can't be used for fixing memory leaks or
> reducing max. memory residency. For example, I can have a function that returns
> an `Int` but allocates lots of intermediate data on the way. In the reports I
> see this function as allocates a lot, but it has no effect on my program's
> residency (especially if it runs fast).
> So I'm thinking of somehow using cost centers for reasoning about memory
> residency. One idea is to print a summary after every major GC, by doing another
> pass on the whole heap and recording attributions. This can be used for plotting
> live data of cost centers over time. (like hp2ps but for cost centers)
> Another idea is to add "residency" column in the profiling reports. Not sure how
> to update this column in runtime though.
> The main use case for me is fixing T1969, but of course this is a very general
> solution.
> Does anyone have any other ideas?

More information about the ghc-devs mailing list