LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Odd swap usage even though there is free RAM (https://www.linuxquestions.org/questions/linux-hardware-18/odd-swap-usage-even-though-there-is-free-ram-366541/)

Artanicus 09-24-2005 09:27 AM

Odd swap usage even though there is free RAM
 
Ive had this weird thing going on for a few months now. The machine has 2*512M RAM (tho only 883 detected, highmem off). Ive also got a gigantic swap partition together amounting to 1788 megabytes.

The chain of events goes like this: When the machine is reebooted, all is fine for a few days. Then, swap usage starts to go up and up and up. atm after 35 days of uptime, swap usage is at 50%, so is RAM. Heres a quote of free -m:
Code:

          total      used      free    shared    buffers    cached
Mem:          883        866        16          0        37        356
-/+ buffers/cache:    473        410
Swap:        1788        883        904

The actual memory usage seems fine to me, allthough its a tad higher than id expect with this level of usage. (apache, mysqld, sshd, proftpd + light desktop usage including fluxbox, xmms, firefox and thunderbird) Also ive had to restart firefox and xmms every few weeks due to them eventually eating up ~300M of RAM on their own. Restarting has freed the extra RAM in use, but never affected swap usage that much.

Now, what ive understood of memory management is that the kernel cahces files to the RAM for faster reads, but it shouldnt do this to the swap, right? So, if my memory has cached RAM to spare, what is being swapped constantly? Is there some fancy way to track what is using the swap space, a top parameter for instance?

This isnt a problem that would cause me any trouble, but im quite intriqued as to what is going on. _I've always thought swap would go unused as long as there was RAM available, right?

*confused*

Sysinfo:
Slackware 10.2
Linux 2.4.31 (bare.i clone with minor additions)

freakyg 09-24-2005 08:18 PM

do you do anything graphics intensive??
I notice when using the Gimp.....that swap gets used, not a whole tho, just enough that I notice it.............

Artanicus 09-25-2005 01:57 AM

I use Gimp every few days or so, but I always close it after im done.

One thats gotten me pondering tho is Captive NTFS. I installed it at about the same timeframe that these problems started. Tho, ive got no idea why it would swap so much data, except if it insists on swapping the NTFS partition the same way the kernel likes to swap files. Well, it hasnt even been on actually for a month now, so I doubt that its the responsible one, except if it forgot to clean its swap usage somehow.. d:

Artanicus 09-28-2005 12:14 AM

Okey, this is getting scary:
Code:

Swap:        1788      1408        379
Alarms are starting to kick in, still got 379 megs of swap free, but that wont last any longer than two days by this rate.. help??

Artanicus 09-28-2005 12:19 AM

okies, figured out how top can monitor swap usage, here are the processes that are over 100 megs:
Code:

  PID USER      VIRT S %MEM SWAP COMMAND                                     
 5598 fyrantha  438m S  0.9 430m python                                       
 5516 root      460m R  6.8 400m X                                             
12258 fyrantha  299m S  3.0 272m xmms                                         
12259 fyrantha  299m S  3.0 272m xmms                                         
12260 fyrantha  299m S  3.0 272m xmms                                         
12261 fyrantha  299m S  3.0 272m xmms                                         
12262 fyrantha  299m S  3.0 272m xmms                                         
12263 fyrantha  299m S  3.0 272m xmms                                         
12265 fyrantha  299m S  3.0 272m xmms                                         
12268 fyrantha  299m S  3.0 272m xmms                                         
17862 fyrantha  299m S  3.0 272m xmms                                         
23647 fyrantha  299m S  3.0 272m xmms                                         
17861 fyrantha  227m S  0.3 224m xmms                                         
 6082 root      141m S  0.1 140m X

The question is, why are they swapping, and why so much?

edit:
I restarted X and all the X apps with it and now swap usage is down to 73 megs, and ram down to a few hundred.. So, all is well for now, but is it normal to have to restart X every month or so, just to cope with memory? Surely there cant be a memory leak in all of X, firefox, gDeskcal(the python process) and xmms?

shazam75 09-28-2005 02:25 AM

Hi

Yes what happens is that once your free memory is used up by an application, not all of it is returned back to the OS - so eventually it will go to your cache and start using that.

That is what is happening. some of the code of certain applications are kept in memory even when you close them, so when you open it later it is alot quicker. Eventually all your memory is gone.


All times are GMT -5. The time now is 11:58 PM.