Improving cost center reports to show residency?

Ömer Sinan Ağacan omeragacan at
Mon Aug 8 11:28:48 UTC 2016

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

Does anyone have any other ideas?

More information about the ghc-devs mailing list