On Tuesday 29 September 2009 03:44:33 am Carl Johnstone wrote: > What everybody else in this thread is referring to as "shared" memory is > actually the amount of memory that hasn't needed to be duplicated because > of the copy-on-write semantics within the Linux kernel. Unfortunately > there's currently no easy way I know of to get these figures on Linux.
In my experience with linux+perl+fastcgi, "VmHWM - (VmExe + VmLib)" (stats from /proc/*/status) gives a reasonable upper bound on the incremental cost of a process -- that is, how much your "free memory" total will go up or down if you add or remove one process. It's a loose upper bound because the stuff that it knows to subtract is quite unlikely to become unshared, but there's a bunch of data that's probably being shared that it doesn't know about. For an example: the formula above gives 14,900kB when applied to an instance of a beta app that I happen to have at hand; actually killing an instance gives an increase in free memory (as reported by "free") of 11,400kB, so the error is 3,500kB. The error depends on the app, but it's otherwise pretty consistent, which makes this a good enough tool to use for a "kill processes that start chewing memory" script. Andrew _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
