Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have 2GB installed on my machine running Ubuntu 12.04. After some time of use, I see much of my RAM used. The RAM does not free enough even though I closed all my programs.

I included 2 screenshots. First is "Gnome system monitor" (all process) and second is "htop" (with sudo), both sorted by memory usage. From both you see, that it's not possible that all running apps takes together 1GB of memory. First 7 biggest programs sum 250, but others are much smaller (all can't sum even 100MB). The cache is 300MB (yellow ||| on htop) and is not included in 1GB used. Also 260MB is already on swap. (which actually makes 1,3GB of used memory)

If i start Firefox (or Chrome) with many tabs, it has only 1GB available and not potentially 1,5 GB (assume 0,5GB is for system). When I need more ram, swapping happens.

So where is my ram? Which program is using it? How can i free it, to be available for e.g. Firefox?

Gnome system monitor gnome system monitor htop htop screenshot (sudo)

share|improve this question
add comment

1 Answer

free -g is probably the best way to tell how much RAM your system is using. See serverfault question here. If you use free -m it will give you a breakdown in Mb.

In this example, from a server with 251Gb RAM:

             total       used       free     shared    buffers     cached
Mem:           251        130        120          0          3         61
-/+ buffers/cache:         66        185
Swap:            5          0          5

Only 66Gb is actually being used, however top reports 137Gb. The RAM isn't freed from the cache until another program requests it, so if you open up another program that requires the RAM it will be allocated to that program.

Essentially I wouldn't worry about the RAM that's available, the OS is taking care of this.

share|improve this answer
    
Thanks for answer. I also checked free -m. According to link from your post I see I am using "only" 882MB. But I am still pretty sure that if I would count all processes I would not sum not even past 500MB. Any more idea? It's ok, that OS is RAM manager, but maybe I can kill some things to free RAM. $ free -m total used free shared buffers cached Mem: 2002 1282 720 0 51 348 -/+ buffers/cache: 882 1120 Swap: 2999 169 2830 –  gsedej Oct 19 '12 at 22:02
    
Can you show the output of free -m when you think swapping is happening to see if the cache is really not being free'd or if swapping should really be happening. Swap isn't a problem if the program you are using isn't reading from it. –  niallhaslam Oct 23 '12 at 22:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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