how to determine a programs memory usage at runtime?

Simon Marlow simonmar at
Mon Jun 21 09:50:39 EDT 2004

On 21 June 2004 09:14, John Meacham wrote:

> There might be some RTS calls to query the heap, but someone else is
> probably more qualified to comment on that.

The value of the mblocks_allocated variable in the RTS will give you the
number of "megablocks" currently mmap()ed into the address space of the
executable, which roughly equates to the amount of memory the program is
using.  A megablock is MBLOCK_SIZE bytes, currently 1Mb.

Megablocks are never released, so this only gives you an upper limit for
the amount of memory in use.


More information about the Glasgow-haskell-users mailing list