Click to See Complete Forum and Search --> : Swap Memory vs RAM


KensLinuxMachine
03-16-2002, 01:27 PM
Ok, I've found a good deal of info on the way that Physical RAM is allocated. Pretty much everything is cached until it reaches a certain age and then ... something happens... (memory is freed? It goes to swap?)

Anyways, I've got 256mb of memory and constantly have a fluctuating free memory of 8-10MB. Cache free is 150MB or so. So I've got the part that the free in cache is what's really "available".

But I'm using 16758k of swapfile space. Or 16766k as it was today. It's gone up a little here, a little there in the past few days. My question is, does Linux ever clean up after itself when it comes to the swap file? Being a finite amount, even if I use a little here and there per day, it will eventually fill up unless some of it is deallocated. If deallocation is going to occur, when? And if not, why not? Am I missing a piece of the puzzle here?

Thanks in Advance,

-Ken

Strogian
03-16-2002, 01:50 PM
Originally posted by KensLinuxMachine:
<STRONG>Anyways, I've got 256mb of memory and constantly have a fluctuating free memory of 8-10MB. Cache free is 150MB or so. So I've got the part that the free in cache is what's really "available".</STRONG>

Hmmm... I'm not sure what you mean by "cache free." What I think you mean is that you are using all but 150MB of the RAM, but the cached data is filling that up, so in reality only about 10 MB of RAM is going unused.

Originally posted by KensLinuxMachine:
<STRONG>But I'm using 16758k of swapfile space. Or 16766k as it was today. It's gone up a little here, a little there in the past few days. My question is, does Linux ever clean up after itself when it comes to the swap file? Being a finite amount, even if I use a little here and there per day, it will eventually fill up unless some of it is deallocated. If deallocation is going to occur, when? And if not, why not? Am I missing a piece of the puzzle here?</STRONG>

I don't really understand exactly how the memory allocation/paging works, but I know the programmers aren't stupid. ;) Your swap space will not just "fill up" with useless data. Once something is put into swap, however, Linux might just never decide to take it out because there's no reason to. But if you actually start running out of swap space, I'm willing to bet that some swap will be freed for the new stuff.

[ 16 March 2002: Message edited by: Strogian ]

Okie
03-16-2002, 04:00 PM
i do not know what all you have running, either in the background or up front as applications, but i have both Redhat 7.1 & slackware 8 with 250 megs of swap, and both Linux distros never use it, i only have 256 megs of RAM and it never gets past two thirds used...

the swap is there if either Linux distro needs it, but they never use it...