Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just started my system and logged on one user. I run top in a shell window under KDE and it shows nearly all of my 1GB of RAM in use. I can't see from the display what is using all that memmory. If you add up the memory under VIRT column, it comes nowhere near the amount shown as used.
Notice the 904496k total, 897056k used.
Also, 28188k buffers. What are those and where are they and who is using them?
Also, this memory usage seems to be relatively static. There are variations over time, but not a lot really much. I ran watch -n 5 -d free and the changes were small and tended to average out over time; up a little, down a little, but no major change.
while running top you can sort the columns. If you type M then the %MEM column will be sorted according to highest usage. If you type c then the command used for that process is listed. Type h for more help or man top from a terminal.
Thank you smoker for the tips on top. That's handy to know that top has many more commands.
Thanks for the link memory management info, Emerson. That's a good explanation.
My system looked this way immediately after I booted, before I'd run any user programs besides X and the monitors themselves. So all the data that is stored in the RAM that is used by the cache must have been saved to disk somewhere and read in again during boot.
Where is the disk copy of the cache saved? What tools exist to examine it and to tune it or modify it? Can it be deleted so the system starts clean with nothing (no data) from a past boot being loaded?
My system looked this way immediately after I booted, before I'd run any user programs besides X and the monitors themselves. So all the data that is stored in the RAM that is used by the cache must have been saved to disk somewhere and read in again during boot.
Nope. All that eye-candy in KDE will be reloaded well before you can notice.
Maybe see if xrestop is any use in showing what the problem is.
Look at this the way that Linux does: memory is a resource to be used, and used completely. It's the only thing in the system that's just as fast as the CPU itself. Even the fastest disk-drive is several orders of magnitude slower. So, Linux wants to use all of it, for something, all the time. If the chosen use is simply, "well, we might need this again sometime soon," and there's no other actual demand for memory manifesting itself anywhere, then Linux will happily use the memory for that purpose -- "well, why not?"
Quite often, you see, there just isn't any competition for memory-space: no swapping is going on and it never will. So, Linux uses leftover memory for "buffers." When a request is made to read something from disk, it'll see if the information is already in a buffer. If so, no disk-I/O is required. And Linux will be absolutely, completely "lazy" about that... the memory will remain allocated until Doomsday, or until some competing use for the space actually appears.
When the demand for memory does increase, if it ever does, then you'll see that Linux first begins to reduce the "buffer" allocation, then begins to be more aggressive about cleaning-up the so-called "working sets" of active processes, and only then, as a last resort, begins to swap in earnest.
Exactly !
Here is my current top, this is with Azureus, Folding@home and firefox with multiple tabs and various panel applets and mysql and apache etc etc....
The machine is still relatively responsive but it's not using swap and almost all the memory is used. Don't worry about it unless you start seeing multiple megs of swap being used.
I might add that windows does exactly the same thing, it just shows more free memory in the sense of available to be used, not that that memory has not been allocated elsewhere for buffering. Linux is more honest about it that's all ;-)
OK, all, I appreciate the info and tips and I understand. But... I still want to know what is in those allocated buffers and cache, if anything. My last question was
Quote:
Where is the disk copy of the cache saved? What tools exist to examine it and to tune it or modify it? Can it be deleted so the system starts clean with nothing (no data) from a past boot being loaded?
Why bother allocating all those buffers if there's nothing to put in them right away? Are they empty or is there data in them? If they are empty, the overhead of allocating empty buffers up front is pointless, as it takes virtually no time to allocate memory that isn't allocated. The only logical reason for doing it is to preload data that Linux thinks will be referenced again. So, again, is some data from previous boots cached and reloaded, and if so, where is that cache stored between boots?
Or am I just not getting this?
Oh well. Time to go smoke a pipe. Frog Morton on the Town in an Altinok meer tonight, I think. Lagavulin and a splash of water on the side.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.