- 论坛徽章:
- 0
|
linux内存经常被用掉90%多,只有一个java程序
Q: Why is Linux using up all my memory?
A: You may notice as you use Linux that a lot of RAM is in use, even when you're not running very many programs. You may be thinking that there are problems with memory leaks, or that your available RAM is being used inefficiently.
One quick and easy way to find out how much RAM you really have available, though, is to use the command-line utility 'free.' If you are running Gnome, KDE, or another graphical interface, open up a terminal window and type 'free' (without the quotes). Its output looks something like this (edited for brevity):
total used free
Mem: 515364 497208 18156
-/+ buffers/cache: 352512 162852
Swap: 497972 176 497796
The significant row in this output is the one labelled -/+ buffers/cache. Notice that out of 512MB of RAM, only 352MB is in use---even though it appears from the first line that 497MB is in use.
Unless you experience significant slowdowns and hard drive activity, it's unlikely that you are experiencing any problems with memory usage. Besides, if you paid good money for all the RAM you have, you might as well be using it---it's no good to you sitting around doing nothing.
Another tool that you may find useful, if you find that a lot of your RAM is being used, is 'top.' Again, from a terminal window or console, type 'top' (without the quotes). You will see a dynamically-updated list of the currently-running programs on your computer. The name of each program is shown on the far right, along with information about how much CPU and memory each program is using. If you press 'M' while 'top' is running, the programs will be shown in decreasing order of memory usage. This may help you to pinpoint what programs are using the most memory. In some cases, those programs can be shut down (if you do not need them running), or configured to use less memory. |
|