LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   system ram never being reclaimed?? (https://www.linuxquestions.org/questions/linux-newbie-8/system-ram-never-being-reclaimed-175573/)

infamous41md 04-28-2004 12:48 PM

system ram never being reclaimed??
 
once my computer is up and running for a few hours, my ram is 85% all maxed out. i have 384MB. even tho there will be hardly any processes running, ram usage stays at 85% and higher. what i do is run this prog:
Code:

int main() { while(1) malloc(0x1000); return 0;}
until the kernel kills it. at that point all the system ram is reclaimed and im back down to using only 10% of my total ram. is this correct behavior?? shouldnt that ram be reclaimed automatically when processes stop running?

watashiwaotaku7 04-28-2004 01:42 PM

this is correct behaviour, linux does not use the same model for memory use as windows does, it takes almost no time to clear the ram but a perceptible pause to load data into it, if your ram is not being used, it is not helping your computer to process data therefore linux leaves files in the ram under a "cached" status, with a low priority this data remains stored until the ram is needed for another application in hopes that if the data is needed again it will not have to resort to pulling it from a much slower hdd which results in increased performance, your little process is actually slowing you down and probably is annoying in itself to have to use it, unless there is a memory leak let your ram fill up and enjoy the benefits it gives you

infamous41md 04-28-2004 02:22 PM

thanks for good answer.

HCLogo 05-20-2004 03:14 PM

so what you're saying is that I shouldn't be worried that most of my RAM is being used? (as long as I don't notice a slow-down that is... )

nukkel 05-20-2004 03:36 PM

Sure -- the moment a process needs more RAM the file buffers will be shrunk automatically.
To see how much of your RAM is used for processes and for buffers use the 'free' command -- the line that says '+/- buffers/cache' shows only the RAM used by your programs.
So relax -- Linux just puts your RAM to good use. And it's got its priorities right: your programs get all the RAM they need, the leftover's for buffers

HCLogo 05-20-2004 10:43 PM

Thanks, just wanted to make sure I read that right. :)


All times are GMT -5. The time now is 06:14 PM.