available memory

Guy Harris guy at auspex.UUCP
Sat Jan 14 17:50:51 AEST 1989


>I'm not sure if this is exactly what you want, but on BSD UNIX (and SunOS)
>you can getrlimit(2) on your data segment.   I don't know about other
>UNIXs.

I think "ulimit" can be coaxed to do much the same thing in System V and
maybe System III.

Unfortunately, I don't know that it's what he wanted:

> I understand that this number would not be guaranteed
> for any length of time, especially in a multi-user system. I 
> really need to use it to instrument a program that is gobbling 
> inordinate amounts of RAM,

It sounds as if he's interested in *physical* memory, rather than
*virtual* memory; "getrlimit" and "ulimit" tells you how big the
system's willing to let your data segment be, but if you make it that
big it may not necessarily fit in memory all at once (or it may have to
push everybody else out in order to do so).  Unfortunately, there's no
standard way of finding out how much free physical memory is free....



More information about the Comp.unix.questions mailing list