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.

Lately, while browsing, I often get that the computer comes to a crawl. At the same time I notice memory consumptions of close to 90% by programs/ 10% as cache as indicated by the System Monitor applet in my panel.

Trying to find out which program is slowing down my computer I issue the top command in the terminal, but adding the numbers in the MEM% column there doesn't even come close to 20%.

  • What is the cause of this discrepancy?
  • What is the correct way to do I find out which program is consuming exessive amounts of memory?

screenshot of discrepance between top and Systems Monitor

I don't know if this is helpfull information, but for reference, the output of free -m is:

             total       used       free     shared    buffers     cached
Mem:          2993       2935         57          0          3        369
-/+ buffers/cache:       2563        429
Swap:         5809       1514       4295
share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

By default, top does not sort by memory usage, but CPU usage. If you're manually adding everything up, you may miss some memory hogs programs which use almost no CPU.

To sort by memory usage, press Shift + F followed by n. Press any other key to return to the overview.

The system monitor panel calculates the memory used, minus buffers and cache, without swap.

  • Total RAM: 2993
  • RAM in use (without buffers and cache cache): 2563
  • 2563 / 2993 = 86%

Your computer became slow because it began to swap. Try upgrading your RAM for better performance. The money is well worth it.

share|improve this answer
add comment

I think top sorts processes by CPU usage, and obviously not all of them fit on the screen. Run 'ps aux', to get the list of all processes, then scroll up and down to see memory usage. Another way is to use htop (install it from the Software Center), then hit f6 to sort and select to sort by MEM%.

share|improve this answer
    
You can choose what top should sort by if you press F. (shift+f) –  Jo-Erlend Schinstad Jun 20 '11 at 7:26
add comment

BUMP: I have the same problem. Also, for some reason my memory usage is not being recorded via gnome-system-monitor; I get flat lines, while my memory usage is at a constant 96% and up via panel-applet.

I found my most accurate depiction, with my presumed result for identifying the memory hog by installing and using htop. Then I pressed F6 and selected Mem% to have it sort by memory usage. Again, my hog was a service for nexpose, which I rarely use, so I'm removing it from start-up with update-rc.d *

share|improve this answer
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.