Subject: tmpfs memory leak?
To: None <tech-kern@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-kern
Date: 10/22/2007 14:56:36
I have an 8M tmpfs filesystem whose available blocks are exhausted over
time. There seems to be a memory leak, because I cannot account for more
than 3M of the use with fstat(1) (for deleted files & dirs) and du(1),
# du -ks /mfs
2724 /mfs
# fstat -f /etc | sort -u -n -k 6,6
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root sh 18746 11 /etc 23 -rw-r--r-- 2108 r
root sh 2244 wd /etc 63 drwxr-xr-x 40 r
root fstat 4581 6 /etc 191 -rw-r--r-- 40960 r
# fstat -f /home | sort -u -n -k 6,6
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root sh 11753 wd /home 259 drwxr-xr-x 120 r
# fstat -f /tmp | sort -u -n -k 6,6
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
# fstat -f /var | sort -u -n -k 6,6
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root cron 2407 wd /var 402 drwxr-xr-x 20 r
root syslogd 2005 9 /var 410 -rw------- 189 w
root syslogd 2005 10 /var 411 -rw------- 8154 w
root syslogd 2005 7 /var 415 -rw-r--r-- 12286 w
root syslogd 2005 11 /var 419 -rw------- 0 w
nobody thttpd 96 wd /var 432 drwxr-xr-x 400 r
quagga zebra 1932 6 /var 478 -rw------- 5 rw
root sleep 23925 2 /var 479 -rw-r--r-- 45008 w
root sleep 7094 2 /var 489 -rw-r--r-- 4079 w
root sleep 4377 2 /var 494 -rw-r--r-- 53026 w
root sleep 26527 2 /var 497 -rw-r--r-- 190547 w
nobody thttpd 96 4 /var 499 -rw-r--r-- 0 w
root sh 16884 4 /var 510 -rw------- 330 w
root cron 2407 3 /var 512 -rw-r--r-- 5 rw
root syslogd 2005 12 /var 1372 -rw-r--r-- 0 w
root sh 1250 1 /var 1553 -rw-r--r-- 12287 w
root sh 2737 1 /var 1734 -rw-r--r-- 0 w
Nevertheless, my tmpfs is full:
# df -hi
Filesystem Size Used Avail %Cap iUsed iAvail %iCap Mounted on
/dev/wd0e 230M 18M 200M 8% 1088 116670 0% /
tmpfs 496K 196K 300K 39% 1211 53 95% /dev
tmpfs 8.0M 8.0M 0B 100% 1856 0 100% /mfs
/etc 230M 18M 200M 8% 1088 116670 0% /permanent/etc
/home 230M 18M 200M 8% 1088 116670 0% /permanent/home
/tmp 230M 18M 200M 8% 1088 116670 0% /permanent/tmp
/var 230M 18M 200M 8% 1088 116670 0% /permanent/var
/mfs/etc 8.0M 8.0M 0B 100% 1856 0 100% /etc
/mfs/home 8.0M 8.0M 0B 100% 1856 0 100% /home
/mfs/tmp 8.0M 8.0M 0B 100% 1856 0 100% /tmp
/mfs/var 8.0M 8.0M 0B 100% 1856 0 100% /var
Does no one else see this? My application may be a bit unusual, both
in that I use null mounts, and in that I have no swap activated.
Could the cause of the leak be an interaction between my null mounts
and tmpfs? Also, I am dimly aware of some reference-counting bug in
tmpfs; it was mentioned in one of ad@'s commits to the vmlocking branch.
(I do not run the vmlocking branch.)
Any pointers appreciated.
Dave
--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933 ext 24