dbell@cup.portal.com (David J Bell) (01/13/89)
Does anyone know of a function, intrinsic to UNIX, or not, that will return the currently-available amount of memory that may be alloc'ed. 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, in library function for which I do not have the source... Thanks, Dave
klee@daisy.UUCP (Ken Lee) (01/14/89)
In article <13490@cup.portal.com> dbell@cup.portal.com (David J Bell) writes: >Does anyone know of a function, intrinsic to UNIX, or not, that >will return the currently-available amount of memory that may >be alloc'ed. 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. Ken -- uucp: uunet!daisy!klee arpanet: daisy!klee@uunet.uu.net "This Lt. Col. is not gonna challenge a decision of the Commander-In-Chief ... and if the Commander-In-Chief tells this Lt. Col. to go stand in the corner and sit on his head, I will do so." - Oliver North
guy@auspex.UUCP (Guy Harris) (01/14/89)
>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....
dwc@homxc.ATT.COM (Malaclypse the Elder) (01/17/89)
try using the ideas for "a memory profiler for unix" or something like that. the paper is in the 1988 summer usenix conference proceedings. danny chen att!homxc!dwc