1The following is a demonstration of the anonpgpid.d script, 2 3 4Here we run it on a system that is implementing memory caps using the 5resource capping daemon, "rcapd", 6 7 # anonpgpid.d 8 Tracing... Hit Ctrl-C to end. 9 ^C 10 PID CMD D BYTES 11 6215 bash R 8192 12 6215 bash W 126976 13 5809 rcapd R 245760 14 6222 memleak.pl R 974848 15 6222 memleak.pl W 3055616 16 17The "memleak.pl" process consumes memory, and we can see above that it has 18encountered both reads and writes to the physical swap device - it is being 19paged out. A bash shell was also effected (which was in the same project that 20rcapd was monitoring). 21 22 23 24The following is an ordinary system that is very low on memory, 25 26 # anonpgpid.d 27 Tracing... Hit Ctrl-C to end. 28 ^C 29 PID CMD D BYTES 30 18885 sendmail R 4096 31 18600 automountd R 4096 32 1 init R 4096 33 2456 inetd R 8192 34 18546 nscd R 8192 35 2400 bash R 12288 36 217 utmpd R 28672 37 221 ttymon R 32768 38 210 sac R 36864 39 18777 snmpd R 49152 40 18440 init R 49152 41 89 nscd R 61440 42 318 syslogd R 73728 43 487 snmpd R 81920 44 2453 inetd R 102400 45 165 in.routed R 131072 46 294 automountd R 135168 47 215 inetd R 135168 48 187 rpcbind R 204800 49 86 kcfd R 290816 50 7 svc.startd R 1015808 51 9 svc.configd R 1478656 52 2 pageout W 23453696 53 54The "pageout" process is responsible for writing all the anonymous memory 55pages to the physical swap device, and we can see from the above that it 56has written 23 Mb. When processes access anonymous memory that has been 57swapped out, a major fault occurs and the memory is paged back in; in this 58case we can trace the process that was effected, and from the above we can 59see that several processes have been effected by the memory pressure. 60The most is "svc.configd", which needed to page back in 1.4 Mb of anonymous 61memory. 62 63 64 65Sometimes anonpgpid.d doesn't help too much. Here we only have pageouts 66to the physical swap device and no pageins, 67 68 # anonpgpid.d 69 ^C 70 PID CMD D BYTES 71 2 pageout W 61083648 72 73Only pageout is identified. 74