From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,eaf21fee355cfab0 X-Google-Attributes: gidfee84,public From: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) Subject: Re: Available process memory on OSF 3.2 Date: 1996/09/05 Message-ID: <50njil$j9u@nntpd2.cxo.dec.com>#1/1 X-Deja-AN: 178749183 distribution: world references: <50l1nv$jev@clic3.qbc.clic.net> organization: Digital Equipment Corporation reply-to: alan@nabeth.cxo.dec.com (Alan Rollow - Dr. File System's Home for Wayward Inodes.) newsgroups: comp.unix.osf.osf1 In article <50l1nv$jev@clic3.qbc.clic.net>, tessierr@berclain.com (Richard Tessier) writes: >I'm looking for a way to get the amount of memory that is available >for a process. Under several other UNIX platforms (HPUX, SCO ...) we >use the available space for the data (using sbrk and ulimit) but this >concept doesn't work under OSF (since it can allocate non-contiguous >memory blocks, the result of sbrk(0) can be over ulimit(UL_GETBREAK) >even if there is no segmentation fault). Is there a way to do >something similar(or better !) that would work on OSF 3.2 ? You can use getrlimit(2) to get the various memory limits for data, stack and text. You can use table(2) to find out how much page/swap space is available and reserved, which is usually the first limit you run into when allocating lots. You can infer the swap mode by looking for the link /sbin/swapdefault, but that can be wrong (recently removed and the system not rebooted yet). The last I knew finding out with certainty required reading from /dev/kmem. There might be other system parameters that will limit virtual memory beyond what the R-limits do, but the amount of page/swap space, swap mode and those limits should be enough to get a good clue. >Richard Tessier Berclain Group Inc. -- Alan Rollow alan@nabeth.cxo.dec.com