0

So, I've got 2 new Ubuntu 8.04 JeOS VMs running, they're both really lightweight and haven't got much running on them at all, no Apache, MySQL etc etc. Yet they're using 350M of RAM and I cannot see why.

I've taken a look using ps -auxw --sort rss but can only see your general sshd, bash etc process running and they're not using much memory at all.

top shows 99.6% idle, so there's nothing CPU intensive running.

free -mt output:

          total       used       free     shared    buffers     cached  
Mem:        503        350        152          0        111        174  
-/+ buffers/cache:      64        438  
Swap:       471          0        471  
Total:      975        350        624

(Yes, it only has 512MB of RAM for testing purposes.

Edit: I also have several VMs running Ubuntu 9.04 32bit server-edition that are using 20-30M of RAM with almost identical packages installed.

David Spillett
  • 22,534
  • 42
  • 66
Kura
  • 223
  • 2
  • 7

1 Answers1

2

Most of the memory used is buffers or cache. The actual used (for other things other than buffer/cache) amount is more like 64Mb as per the second line of your free output.

The memory used for cache and buffers can generally be cleared and used when an application needs it, but while there is spare memory the kernel will use it for this purpose to try reduce I/O load.

You can forcibly clear most of the cache and buffers with sync; echo 3 > /proc/sys/vm/drop_caches, then rerun free to see the difference.

It isn't quite as clear-cut as this as other things get counted against the buffers or cache total, including tmpfs filesystems and VM's memory allocated on the host in some virutalisation products (though this won't be an issue here, as this is the VMs you are talking about, not the host). See the answers to this question for more detail, as I'm straying off the point of this specific question.

David Spillett
  • 22,534
  • 42
  • 66