What do the following numbers mean?

Ben Lippmeier benl at ouroborus.net
Tue Apr 3 01:46:07 CEST 2012

On 02/04/2012, at 10:10 PM, Jurriaan Hage wrote:
> Can anyone tell me what the exact difference is between
>  1,842,979,344 bytes maximum residency (219 sample(s))
> and
>   4451 MB total memory in use (0 MB lost due to fragmentation)
> I could not find this information in the docs anywhere, but I may have missed it.

The "maximum residency" is the peak amount of live data in the heap. The "total memory in use" is the peak amount that the GHC runtime requested from the operating system. Because the runtime system ensures that the heap is always bigger than the size of the live data, the second number will be larger.

The maximum residency is determined by performing a garbage collection, which traces out the graph of live objects. This means that the number reported may not be the exact peak memory use of the program, because objects could be allocated and then become unreachable before the next sample. If you want a more accurate number then increase the frequency of the heap sampling with the -i<sec> RTS flag.


More information about the Glasgow-haskell-users mailing list