Spray soapy water on it and look for bubbles :)
--- [email protected] wrote: From: Michael MacIsaac <[email protected]> To: [email protected] Subject: How to find a memory leak? Date: Thu, 9 Jul 2015 08:19:20 -0400 Hello list, I have a SLES 11 SP3 system that is leaking memory, but I don't know how or where. I find a script on the Internet that runs forever, adapt it somewhat, and start logging some info to a temp file. Here's the script: # cat memusage #!/bin/bash # # track memory usage # outFile="/tmp/memusage" while true do echo "---------------------------------------------------" >> $outFile date >> $outFile ps aux --sort -vsz | head -22 >> $outFile echo >> $outFile free -m >> $outFile sleep 300 done After a fresh reboot of a 512 MB virtual machine, I start the script and the first entry in the temp file shows about 20 MB (512 - 492) used by Linux and 97 MB used by processes: Wed Jul 8 12:37:45 EDT 2015 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2181 0.0 0.2 115404 1024 ? Ssl 12:36 0:00 /usr/sbin/nscd root 1851 0.0 0.1 11512 692 ? S<sl 12:36 0:00 /sbin/auditd -s disable root 2556 0.3 0.7 11456 4004 ? Ss 12:37 0:00 sshd: root@pts/0 root 2306 0.0 0.7 10720 3700 ? Ss 12:36 0:00 /usr/sbin/httpd2-prefork wwwrun 2307 0.0 0.4 10720 2204 ? S 12:36 0:00 /usr/sbin/httpd2-prefork wwwrun 2308 0.0 0.4 10720 2204 ? S 12:36 0:00 /usr/sbin/httpd2-prefork wwwrun 2309 0.0 0.4 10720 2204 ? S 12:36 0:00 /usr/sbin/httpd2-prefork wwwrun 2310 0.0 0.4 10720 2204 ? S 12:36 0:00 /usr/sbin/httpd2-prefork wwwrun 2311 0.0 0.4 10720 2204 ? S 12:36 0:00 /usr/sbin/httpd2-prefork root 1853 0.0 0.1 10428 824 ? S<sl 12:36 0:00 /sbin/audispd root 997 0.0 0.6 9036 3224 ? Ssl 12:36 0:00 /usr/sbin/console-kit-da root 2265 0.0 0.5 8136 2532 ? Ss 12:36 0:00 /usr/lib/postfix/master postfix 2277 0.0 0.4 8004 2372 ? S 12:36 0:00 qmgr -l -t fifo -u postfix 2276 0.0 0.4 7948 2352 ? S 12:36 0:00 pickup -l -t fifo -u root 2172 0.0 0.3 7916 1532 ? Ss 12:36 0:00 /usr/sbin/sshd -o PidFi 101 994 0.0 0.5 7852 2804 ? Ss 12:36 0:00 /usr/sbin/hald --daemon root 1869 0.0 0.8 6464 4504 ? Ss 12:36 0:00 /sbin/haveged -w 1024 - root 2559 1.0 0.6 6056 3076 pts/0 Ss 12:37 0:00 -bash root 998 0.0 0.2 3980 1332 ? S 12:36 0:00 hald-runner root 2591 0.0 0.3 3652 1604 pts/0 S+ 12:37 0:00 /bin/bash /usr/local/sb root 2343 0.0 0.1 3508 944 ? Ss 12:36 0:00 /usr/sbin/xinetd -pidfi total used free shared buffers cached Mem: *492 97* 394 0 5 50 -/+ buffers/cache: 41 450 Swap: 898 0 898 This morning the last entry shows 156 MB used by processes: ~59 MB of memory lost in less than a day. But the 'VSZ' of the top 22 processes seems to be about the same: Thu Jul 9 07:57:47 EDT 2015 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2181 0.0 0.2 115404 1088 ? Ssl Jul08 0:00 /usr/sbin/nscd root 1851 0.0 0.1 11512 692 ? S<sl Jul08 0:00 /sbin/auditd -s disable root 44879 0.0 0.7 11456 4008 ? Ss 07:36 0:00 sshd: root@pts/1 root 44913 0.0 0.7 11456 4008 ? Ss 07:37 0:00 sshd: root@pts/2 root 2306 0.0 0.7 10720 3700 ? Ss Jul08 0:01 /usr/sbin/httpd2-prefork wwwrun 2307 0.0 0.4 10720 2204 ? S Jul08 0:00 /usr/sbin/httpd2-prefork wwwrun 2308 0.0 0.4 10720 2204 ? S Jul08 0:00 /usr/sbin/httpd2-prefork wwwrun 2309 0.0 0.4 10720 2204 ? S Jul08 0:00 /usr/sbin/httpd2-prefork wwwrun 2310 0.0 0.4 10720 2204 ? S Jul08 0:00 /usr/sbin/httpd2-prefork wwwrun 2311 0.0 0.4 10720 2204 ? S Jul08 0:00 /usr/sbin/httpd2-prefork root 1853 0.0 0.1 10428 824 ? S<sl Jul08 0:00 /sbin/audispd root 997 0.0 0.6 9036 3224 ? Ssl Jul08 0:00 /usr/sbin/console-kit-da root 2265 0.0 0.5 8136 2532 ? Ss Jul08 0:00 /usr/lib/postfix/master postfix 2277 0.0 0.4 8004 2372 ? S Jul08 0:00 qmgr -l -t fifo -u postfix 44778 0.0 0.4 7948 2356 ? S 06:56 0:00 pickup -l -t fifo -u root 2172 0.0 0.3 7916 1664 ? Ss Jul08 0:00 /usr/sbin/sshd -o PidFi 101 994 0.0 0.5 7852 2852 ? Ss Jul08 0:00 /usr/sbin/hald --daemon root 1869 0.0 0.8 6464 4504 ? Ss Jul08 0:00 /sbin/haveged -w 1024 - root 44882 0.0 0.6 6056 3052 pts/1 Ss 07:36 0:00 -bash root 44916 0.0 0.5 6056 2876 pts/2 Ss+ 07:37 0:00 -bash mike 44992 0.0 0.5 6056 3004 pts/1 S+ 07:56 0:00 -bash total used free shared buffers cached Mem: *492 156 * 335 0 24 83 -/+ buffers/cache: 48 443 Swap: 898 0 898 Is there a better way to detect memory leaks? Are there any known 'culprits'? Any help will be appreciated. Thanks. -Mike MacIsaac ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/ _____________________________________________________________ Netscape. Just the Net You Need. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/
