andrew@teslab.lab.OZ (Andrew Phillips) (06/11/91)
We will shortly have many more users here and I need to determine how much RAM various programs use. It would also be nice if we could tell at any time how much RAM is unused. Using malloc() is useless since the most I can malloc() is always about 4.7 Mbytes, because of virtual memory. On a similar vein. Is it possible to tell the system to use some memory areas before others. We can have a maximum of 8 Mbytes of 32 bit memory. If we go beyond and add 16 bit memory then we would want it used after the 32 bit RAM. Any help would be most appreciated. -- Andrew Phillips (andrew@teslab.lab.oz.au) Phone +61 (Aust) 2 (Sydney) 289 8712
rfarris@rfengr.com (Rick Farris) (06/13/91)
In article <1265@teslab.lab.OZ> andrew@teslab.lab.oz.au (Andrew Phillips) writes: > It would also be nice if we could tell at any time how > much RAM is unused. Here's a short perl script that shows how much memory is used and how much is available. I didn't write it, any kudos should go to Rock Kent; rock@rancho.uucp. --- #!/usr/local/bin/perl eval "exec /usr/local/bin/perl -S $0 $*" if $running_under_some_shell; open(PS, "ps -el |"); while (<PS>) { $tot += substr($_, 48, 6); } close(PS); open(SAR, "sar -r 1 |"); while (<SAR>) { $tot2 = substr($_, 9, 7); } close(SAR); printf "\nUsed : %4.2f mb\n", $tot / 1024; printf "Avail: %4.2f mb\n", ($tot2 * 4096) / 1024000; --- Output of above program: serene:/u/rfarris> pmem Used : 4.64 mb Avail: 6.24 mb -- Rick Farris RF Engineering POB M Del Mar, CA 92014 voice (619) 259-6793 rfarris@rfengr.com ...!ucsd!serene!rfarris serenity bbs 259-7757