detecting memory size?

Glynn Clements glynn.clements at virgin.net
Thu Jan 29 12:31:33 EST 2004


Ketil Malde wrote:

> > What do you mean by "memory size"? How much RAM is installed in the
> > system? The amount which the process is currently using? The amount
> > which the OS might be willing to allocate to your process at any given
> > point in time? Something else?
> 
> My aplogies for being unclear!  What I really want is the amount of
> memory my application can allocate and excercise lively without
> causing thrashing.  On my Linux computer, that amounts more or less to
> the installed, physical RAM, minus a bit, so I'll settle for that. :-)
> 
> (After browsing various information, it seems I'm after the minimum of
> physical RAM and getrlimit(RLIMIT_DATA)).

IIRC, getrlimit(RLIMIT_DATA) doesn't mean much on Linux, as it doesn't
include memory which is added using mmap(..., MAP_ANON), which is used
by glibc's malloc(). Also, getrlimit(RLIMIT_RSS) is probably more
relevant for your purposes.

-- 
Glynn Clements <glynn.clements at virgin.net>


More information about the Glasgow-haskell-users mailing list