Ubuntu takes too much memory even if all processes killed
Here's what i have with Ubuntu 9.10:
Code:
ruslan@hplaptop:~$ ps -Ao%mem,pid,cmd So, almost no processes, nothing mounted, no kernel modules and still 145M of RAM in use! What could be using so much memory? AFAIK linux kernel should work on 32M (maybe even less) machine... |
Arch32, KDE 4.3.4, nothing open except Firefox and a terminal:
Code:
[root@Ath mherring]# free I'll go take a quick look with XFCE.... |
Quote:
|
Running XFCE4, with only FF and a terminal:
Code:
[mherring@Ath Desktop]$ free |
Quote:
KDE: Quote:
Quote:
|
Hmmmm---for those of us who struggle with the most basic things, could you explain??
|
Well, what you thought of being memory usage is just actual usage by apps + buffers + cache. Buffers & cache are enlarged (as needed) when the memory gets free and shrinked when an app needs more memory than is available.
+/- buffers/cache line gives information with buffers & cache subtracted from full memory utilization, so it's what you actually need to estimate memory use by apps. |
Memory management is a can of worms. In Linux it's exacerbated by the fact that (de-)allocation is lazy - it's only done when needed, or maybe in a "quiet time". It's too expensive to continually run the queues moving page frames around between free and allocated. Hence storage can appear (still) allocated even when the task has terminated.
Then there are the shared libraries ... and dentry and inode caches ... and things that aren't apparently accounted for anywhere. There are a pile of sysctls for managing the points at which decisions can be affected - have a look at /proc/sys/vm/ I'd suggest you only play with such on a test system. /proc/meminfo for overall system metrics - for specific tasks see /proc/<pid>/smaps |
Quote:
|
You want to run something it uses memory - you just don't (generally) get any say in what memory it uses.
|
Quote:
I'm not the most technically minded here, but in my own personal experience with several older versions of Windows on quite a few different PCs, it seemingly prefers the swap file over RAM; Whenever RAM dropped below 74% free, regardless of how much your system actually had, it really slowed to a crawl, as it had to access swap just to open a menu! And that's why Windows has always needed far more than the 'minimum requirement' to actually work, but CPU usage still hardly ever exceeded 19% as the system was still at the mercy of the HDD. Windows won't not swap. Ever. |
Quote:
|
Quote:
I did try that once though, and it crashed. I had to hard-reset the PC and boot into 'safe' mode to re-enable swap. That was with Win98 on a PII w/128Mb RAM. It would work if you had a lot more, I suppose. Cheers |
Just because a program/process is (or even all of them are) killed, does not mean the kernel will remove latent cached copies of blocks of disk data. If you restart one of these programs, it will start faster by virtue of not having to physically read those block of data from disk the first time. That's what cache is about.
If you want to see how much memory would be free, you could modify the startup scripts to display the sizes and pause. That way you can see before very much gets started. Or write/find a program that just allocates and uses up as much RAM as it can, which will eventually force cached data to go away. After that program runs a while, kill it, and then see how much is free (data a program allocates for itself will go away when the program process exits). |
Well, it's seen that the memory is really used not for cache because when i start more and more programs, memory usage is increased, and when about 90% is shown as used, swap starts to be used instead of unallocation of cache.
Hmm... i restarted the machine and now it's using 33M without gdm... seems not very reproducible... |
All times are GMT -5. The time now is 11:33 AM. |