[Pkg-sysvinit-devel] Bug#390184: Bug#390184: DO NOT WASTE MY MEMORY !!!

Henrique de Moraes Holschuh hmh at debian.org
Sat Feb 21 13:08:11 UTC 2009

On Sat, 21 Feb 2009, Rieker Flaik wrote:
> Am Samstag, den 21.02.2009, 00:04 -0300 schrieb Henrique de Moraes
> Holschuh:
> > On Sat, 21 Feb 2009, Rieker Flaik wrote:
> > > I just hate it to see that /dev/shm and /lib/init/rw use hundrets of
> > > Megabyte of my RAM!!!
> > 
> > They don't.  That's the maximum ammount of virtual memory they're allowed to
> > use, just that.
> > 
> > Unless, of course, something is filling those filesystems with junk?  THEN
> > they will take up to that ammount of virtual memory (most of which CAN be
> > swapped, I don't know if the inode tables are swappable, but the file data
> > IS).
> I checked the directory and watched at "df": 512 MB big but 0% used.
> With "xosview" or "top", the useable RAM is my real amount minus he 512.
> So where is the "CAN" now? I just don't get it.

Fair enough, these things can confuse anyone.  You don't have to take my
word for it, you can ask the kernel people directly if you want, in the
linux-kernel ML.

That said, here is a test to comprove it. 

Allocate an 1GB tmpfs and check the changes in system memory allocation,
they should be MUCH smaller than 1GB.  Some memory IS used by the tmpfs for
book-keeping even while empty, and the test also causes a little cache churn
since it writes to a filesystem.

In the box I run the test, /tmp is ALSO tmpfs.  Even then, the test used
less than 32768 *bytes* in total, and that includes the two new /tmp/1 and
/tmp/2 files, plus the mountpoint.  Do the test in single-user mode if you
have crap running in background that could be allocating memory.

Arch is Intel 32 bits (i686).

thorin:~# mkdir /tmp/mountpoint ; cat /proc/meminfo >/tmp/1 ; mount -t tmpfs tmpfs /tmp/mountpoint -o size=1G ; cat /proc/meminfo >/tmp/2 ; diff -u /tmp/1 /tmp/2 ; umount /tmp/mountpoint ; rmdir /tmp/mountpoint
--- /tmp/1      2009-02-21 09:56:41.000000000 -0300
+++ /tmp/2      2009-02-21 09:56:41.000000000 -0300
@@ -1,29 +1,29 @@
 MemTotal:        2073992 kB
-MemFree:         1798780 kB
+MemFree:         1798764 kB
 Buffers:           15500 kB
-Cached:           136340 kB
+Cached:           136344 kB
 SwapCached:            0 kB
-Active:           120072 kB
-Inactive:          98576 kB
-Active(anon):      67020 kB
+Active:           120068 kB
+Inactive:          98580 kB
+Active(anon):      67016 kB
 Inactive(anon):        0 kB
 Active(file):      53052 kB
-Inactive(file):    98576 kB
+Inactive(file):    98580 kB
 Unevictable:          52 kB
 Mlocked:              52 kB
 HighTotal:       1184648 kB
 HighFree:         978360 kB
 LowTotal:         889344 kB
-LowFree:          820420 kB
+LowFree:          820404 kB
 SwapTotal:       1951888 kB
 SwapFree:        1951888 kB
-Dirty:                 4 kB
+Dirty:                12 kB
 Writeback:             0 kB
-AnonPages:         66880 kB
+AnonPages:         66876 kB
 Mapped:            50272 kB
-Slab:              12660 kB
+Slab:              12664 kB
 SReclaimable:       8000 kB
-SUnreclaim:         4660 kB
+SUnreclaim:         4664 kB
 PageTables:         3088 kB
 NFS_Unstable:          0 kB
 Bounce:                0 kB

  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

More information about the Pkg-sysvinit-devel mailing list