LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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

Reply
 
Search this Thread
Old 01-06-2006, 05:26 PM   #1
Gunark
LQ Newbie
 
Registered: May 2004
Posts: 13

Rep: Reputation: 0
Angry X takes 460+ megs of memory


I recently switched from xfce4 to KDE 3.5, and I've started noticing that X's memory usage slowly crawls up during normal use. It starts off at maybe 40 MB, and over the course of 2 or 3 hours crawls up to the hundreds of MB. Right now it's at 461, but I've seen it as high as 650 (at this point my computer, which has 1 GB of memory, tends to crap out).

This could very well have been happening before KDE, but if so, I didn't notice it. I'm not doing anything special with the system. Mostly just running Eclipse, Firefox, and amaroK.

I'm using xorg-x11 6.8.2. I also recently upgraded my kernel from 2.6.13 to 2.6.14.

Any ideas what's going on? Google says it's normal for X to take up a lot of RAM, because it "maps it to other things, blah blah blah". But 460 is a bit excessive, isn't it? I might as well go back to XP.... maybe I'm seeing some sort of memory leak?
 
Old 01-06-2006, 05:45 PM   #2
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
Yes, but how much ram are you REALLY using for apps and how much is just spare buffers and cache? Show the output of the free command... Chances are you are not really using much ram at all, rather it is the normal use linux makes in cache and buffers... Linux tends to use ALL ram available. What is the point of having ram just sitting there rather than use it for something... You paid good money for that ram.

And there is no reason for a machine to 'crap out' when using that little amount of ram unless the ram is faulty. What do you mean by 'crap out'? I only have 512 meg, which is in full use all the time eg:

Code:
[amosf@shiva amosf]$ free -mt
             total       used       free     shared    buffers     cached
Mem:           503        489         13          0         34        163
-/+ buffers/cache:        290        212
Swap:         1102        133        969
Total:        1606        625        980
Note that 489 meg is used, but 212 meg of the ram is in buffers and cache and so still 'available'... Of course I'm swapping a bit here do to the application load...
 
Old 01-06-2006, 06:20 PM   #3
Gunark
LQ Newbie
 
Registered: May 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Aha thanks for that. I guess the 'free -mt' command is what I needed:

Code:
             total       used       free     shared    buffers     cached
Mem:           883        867         16          0         13        506
-/+ buffers/cache:        347        536
Swap:          494        386        107
Total:        1378       1254        123
Looks like I've got plenty of usable free memory there.

By "crap out", I mean that when the memory graph running in my KDE panel shows that there is no more free memory (i.e. application memory is at or near 100%, not the cached or buffered stuff), the swapping goes into overdrive, and X becomes essentially unresponsive. Sometimes I can get out by Alt+Ctrl+Backspace, but usually I'm just forced to reboot.

Up until now I assumed it was the X issue, but I guess I've just been running too many applications at the same time (it usually seems to happen during gcc compiles, so maybe that).

Quote:
Originally Posted by amosf
Yes, but how much ram are you REALLY using for apps and how much is just spare buffers and cache? Show the output of the free command... Chances are you are not really using much ram at all, rather it is the normal use linux makes in cache and buffers... Linux tends to use ALL ram available. What is the point of having ram just sitting there rather than use it for something... You paid good money for that ram.

And there is no reason for a machine to 'crap out' when using that little amount of ram unless the ram is faulty. What do you mean by 'crap out'? I only have 512 meg, which is in full use all the time eg:

Code:
[amosf@shiva amosf]$ free -mt
             total       used       free     shared    buffers     cached
Mem:           503        489         13          0         34        163
-/+ buffers/cache:        290        212
Swap:         1102        133        969
Total:        1606        625        980
Note that 489 meg is used, but 212 meg of the ram is in buffers and cache and so still 'available'... Of course I'm swapping a bit here do to the application load...
 
Old 01-06-2006, 07:54 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,131

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
Probably still shouldn't happen.
I'd go with more swap as a short-term fix; note the ratio of mem-to-swap on your system compared to amosf.
Add another Gig of swap - you can have more than one, so just create another and add it to fstab.
See how it goes after that.
 
Old 01-06-2006, 09:16 PM   #5
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
Ram use looks good, though it does seem to be swapping a lot considering the amount of ram you have... I'd also suggest adding more swap. You should be able to run a lot of apps, I run 12 virtual desktops and often have at least one app in each. You may have some app with a memory leak that is chewing memory... mozilla and firefox can eat the ram at times...

Anyway, the swap use is a good indicator that you probably need more swap space, so as said above you probably should add a gig of swap and see what happens (you can add a swap fil if you don't have partition space, see man mkswap) If it's still chewing most of the swap, then there is something not quite right.

It seems odd that you are using that much swap and yet have good ram use. Do you start and end some big apps or big 3D game perhaps?
 
Old 01-08-2006, 03:58 PM   #6
Gunark
LQ Newbie
 
Registered: May 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Alright thanks. Will do.

By the way, I wasn't just seeing things afterall. I've had X running for a few days now, and it is now taking up 319 MB of memory--not just cached/buffered/swap stuff, but actual physical memory (or so KSysGuard tells me).

With no applications other than firefox running my `free -mt` output looks like this:

Quote:
total used free shared buffers cached
Mem: 883 619 264 0 14 180
-/+ buffers/cache: 424 459
Swap: 494 202 292
Total: 1378 821 556
319 of that 459 is X.... that's really not right! (And no, I'm not doing anything fancy with KDE...)

Anyway I'll allocate more swap and see if that helps. I'm still a little concerned something worse is going on here though.
 
Old 01-09-2006, 12:22 AM   #7
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
Firefox does tend to chew up the ram... But it does seem you are using a lot of ram and too much swap unless you are running a lot of apps. I'm only using about 250 meg ram (actually used) and no swap, and I'm running kmail, knode, firefox, and several terms... So if you are just running firefox then it does seem you are using a bit much...
 
Old 03-01-2006, 01:35 PM   #8
Gunark
LQ Newbie
 
Registered: May 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Well two months later, I'm still having memory issues in Liux. I find myself restarting X daily, because after a day's uptime my memory use slowly creeps up to 100% and eventually my system becomes unresponsive (i.e. more and more swap use, until everything is being swapped constantly).

Right now I have NOTHING running except X -- no other active applications, except for the usual KDE trinkets (I'm writing this from another computer) -- and the KDE System Guard applet is showing my Application Memory as using about 60%, while Buffered and Cached memory are using maybe 10% at most.

Something is wrong here. I think the culprit may be Eclipse or SWT. Are there any known memory leak issues with Eclipse/SWT? I should add though that I only really started noticing this memory problem after I switched from Gnome/XFCE4 to KDE.

P.S. I've also now increased my total swap to 1.5 GB, so that can't be it.

P.P.S. Here is my free -mt output:

Code:
             total       used       free     shared    buffers     cached
Mem:           883        652        230          0         66        173
-/+ buffers/cache:        411        471
Swap:         1458          0       1458
Total:        2342        653       1688
Does this mean that 411 MB of that 652 IS in fact buffered/cache? If so, why is the KDE System Guard showing this as "Application" memory rather than "Buffered" or "Cached" memory?

Last edited by Gunark; 03-01-2006 at 01:37 PM.
 
Old 03-01-2006, 02:15 PM   #9
Vgui
Member
 
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31
That definately sounds like a memory leak, as something this critical would have been picked up by many other X users a long time ago. Maybe it is a wayward process or some KDE app that isn't doing so well. Perhaps watch "ps -ef" and "top", and maybe try some sort of memory profiler for each app.
Personally I haven't had any memory leak issues with Eclipse or Firefox. Their RAM usage does go up as you do more, but just letting it idle shouldn't somehow suck up RAM.
 
Old 03-01-2006, 02:18 PM   #10
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
there was a time right after xfree4 came out with new modular design when x had a huge memory leak in it.

given the general level of instability introduced by xorg i would say for your setup you have a bad memory leak in x. try other video driver or new/older version of xorg. Or better yet try xfree86.
 
Old 03-01-2006, 05:44 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,131

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
Maybe something like this might help.
 
Old 03-03-2006, 12:57 AM   #12
Gunark
LQ Newbie
 
Registered: May 2004
Posts: 13

Original Poster
Rep: Reputation: 0
well i dunno what the hell is going on here...

xrestop is showing X as only using 17 MB total... top shows X as using 378 MB... this is (sort of) confirmed by free -mt, which shows that I am using 772 MB, 476 of which is in buffers/cached, meaning that i'm still using up about 300 MB for god knows what.

Since nothing shows up in xrestop, I'm not really sure what's going on... I should mention this happens with both the radeon and fglrx drivers, so I don't think that's it... My last hope I guess will be to try XFree86 instead of xorg......... or i can just kick these headaches good by once and for all and go back to Windows
 
Old 03-03-2006, 01:42 AM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,131

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
Note the comment on the homepage re underestimating pixmap memory usage.
BTW, I've never used it, merely came across it some time ago in my wanderings ...
 
Old 03-03-2006, 02:03 PM   #14
aldimeneira
Member
 
Registered: Jun 2005
Distribution: Ubuntu
Posts: 132

Rep: Reputation: 15
I haven't noticed memory problems with X11.

...you may try other WM if you don't like it; like Xgl or Y.
 
Old 03-04-2006, 01:36 PM   #15
Gunark
LQ Newbie
 
Registered: May 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Well upgrading to xorg 7.0 seems to have fixed the problem. I've had the system up for two days now and memory usage is still sane.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Suddenly my system takes twice the memory Imerion Linux - General 5 12-21-2005 06:19 PM
after 14 megs it says out of space (while using dcfldd) osat3ch Linux - Software 2 08-01-2005 08:53 AM
Linux Boot problems with 640 Megs + Memory Billy_Russell Linux - General 2 08-04-2003 10:22 AM
Epson Stylus 460 with RedHat Linux 8.0 rupak Linux - Hardware 1 02-12-2003 09:46 PM
ISO's over 700 megs loganwva Linux - Distributions 6 10-06-2002 04:45 AM


All times are GMT -5. The time now is 10:51 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration