1

I have a small VPS server that I use as both a micro and development webhost and as a platform for whenever I want to do something somewhere that isn't my laptop. It's somewhat underspec with only 128M ram available (256 burst), but it works.

To deal with this, I have turned down a bunch of settings, etc. However, it still ends up reaching my cap whenever I try to do stuff.

I have done a bunch of research into this, but can't find anything other than people who mistook buffers and cache for actual process memory use.

I keep feeling like something doesn't add up right, so I finally tried

sh-3.2$ free
             total       used       free     shared    buffers     cached
Mem:        131072     131072          0          0          0          0
-/+ buffers/cache:     131072          0
Swap:            0          0          0
sh-3.2$ ps aux | awk '{sum += $4} END {print sum}'
67.4
sh-3.2$

So while all of my processes add up to 2/3 of my total, I'm somehow still entirely out of ram. htop agrees with both of them (bar at the top says 128M/128M; numbers agree).

Is it possible that free isn't keeping track correctly or something due to the VPS? Or is there actually something mysterious using 30% of my available ram?

2 Answers 2

1

You are summing the resident set for the processes. This excludes any virtual space non-resident but allocated. (This can't be allocated from swap as you don't have any.) As noted above, your calculation also excludes the kernel and its data structures.

Shared code and unused stack space also figure into virtual size. When you map a library you may only page in a small part of the library (resident set), but need to allocate space for the entire library (virtual set). Only read-only space for a shared library is double counted.

1

How much memory is your kernel using?

grep Memory /var/log/syslog and look at the reserved field.

3
  • That doesn't return anything for me. When I do it case-insensitive, I just get a ton of hits about being out of memory.
    – zebediah49
    Jul 29, 2010 at 5:31
  • Hmm, I'm expecting to see something from the kernel during bootup; perhaps it's in a different logfile on your system. Here's mine: Jul 28 20:51:33 gunstar kernel: [ 0.000000] Memory: 3935668k/5177344k available (5422k kernel code, 1092596k absent, 149080k reserved, 2979k data, 880k init) The 149080k reserved is the memory used by my kernel itself. My theory is that your kernel is taking up some or all of your missing 32%.
    – jaq
    Jul 29, 2010 at 5:53
  • I would expect it to take some, but that seems excessive. I just restarted it, to try to work on that, and I still don't get a line like that. I'm beginning to think that the virtual nature of the server means that it's doing something weird. Even so, after restarting it more or less is behaving properly.
    – zebediah49
    Jul 29, 2010 at 6:00

You must log in to answer this question.