how to determine a programs memory usage at runtime?

Simon Marlow simonmar at
Tue Jun 22 04:27:40 EDT 2004

On 22 June 2004 03:51, Bernard James POPE wrote:

> The mblocks_allocated variable should give me what I want.
> I think having access to this would also be useful to people who are
> profiling their programs. You see a few papers where people want to
> report how much memory their application needs, and having a
> high-water mark is usually good enough. Beats trying to get the
> information from top. 

Note that this only counts memory allocated by the GHC storage manager;
it doesn't include the data segments, malloc(), the C stack, or other
mmap()'d stuff.  Be careful if your program is using any of these other
allocation methods (perhaps via an external library through the FFI).


More information about the Glasgow-haskell-users mailing list