5

I have a VPS (Ubuntu 14.04) with 512MB of RAM. This used to be quite enough, but for a while, this has been causing problems -- something is eating up all of that memory, and my debugging has left me clueless.

I have turned off Apache, MySQL, etc, and I am still using 90% of the memory. It just boggles my mind. I have restarted multiple times.

Screenshot

I'm sure I'm just being dumb, but I'd appreciate any wisdom that this community could impart concerning this issue.

4

You have only 500 MB of RAM installed. I would not be surprised that most of it is in use, given those little resources.

On the other hand, htop sums up both the really used memory (allocated by applications) and the cache (used by the system to cache disk access, but immediately available to applications if needed). Therefore the "non-free" memory amount looks much greater than it actually is.

Check the output of free -h, it will give you more detail:

            total        used        free      shared  buff/cache   available
Mem:          11G        1,2G        9,2G         30M        1,2G         10G
Swap:        7,5G          0B        7,5G

While the used column shows you how much memory is in use in total (like htop), the available column shows you the amount of memory that is allocatable by applications. This is usually the number that is interesting to end-users.

Alternative output format (copied from the link at the bottom):

             total       used       free     shared    buffers     cached
Mem:          1504       1491         13          0         91        764
-/+ buffers/cache:        635        869
Swap:         2047          6       2041

In this format, the interesting number of allocatable RAM is located in the free column, but in the -/+ buffers/cache row.

Related must-read website: http://www.linuxatemyram.com/

  • 1
    Thanks for the very helpful answer! I now know that I have 140MB free. But I'm still confused as to what's using the other memory! htop, as you were able to see, is saying that none of the processes are using more than 1% of RAM, unless I'm reading that wrongly as well. Do you have any idea where the other 300MB are going? Surely the OS isn't using that by itself? This is a server, after all – forresthopkinsa Jun 23 '16 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.