LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-24-2005, 09:27 AM   #1
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
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)

Last edited by Artanicus; 09-24-2005 at 09:28 AM.
 
Old 09-24-2005, 08:18 PM   #2
freakyg
Member
 
Registered: Apr 2005
Distribution: LFS 5.0 and 6.1
Posts: 705

Rep: Reputation: 30
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.............
 
Old 09-25-2005, 01:57 AM   #3
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Original Poster
Rep: Reputation: 31
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:
 
Old 09-28-2005, 12:14 AM   #4
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Original Poster
Rep: Reputation: 31
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??
 
Old 09-28-2005, 12:19 AM   #5
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Original Poster
Rep: Reputation: 31
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?

Last edited by Artanicus; 09-28-2005 at 12:41 AM.
 
Old 09-28-2005, 02:25 AM   #6
shazam75
Member
 
Registered: Oct 2004
Location: Australia, Brisbane
Distribution: Gentoo
Posts: 296

Rep: Reputation: 30
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about RAM allocation and what 'seems' like very odd swap use NoeticRapture Slackware 8 06-25-2005 03:08 PM
Swap Usage ComputerErik Slackware 3 05-06-2005 02:33 PM
RAM/SWAP usage ganja_guru Linux - Software 13 12-29-2004 03:17 AM
another odd command usage citrus Linux - Software 13 05-11-2004 03:26 PM
RAM usage Serena Linux - General 1 08-12-2003 10:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration