LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-31-2004, 12:26 AM   #1
Boyer
Member
 
Registered: Oct 2004
Location: Saint John, New Brunswick, Canada
Distribution: Mandrake 10.0 w/ KDE 3.3.1
Posts: 42

Rep: Reputation: 15
Tips on reducing memory consumption


Hello!

I'm by no means an linux expert, but I'm a good many rungs up the ladder from newbie. I've been using Linux for several years, off and on, and mainly in server applications, but now I am running a linux box as my primary worksation. (see my signature for specs)

I noticed recently that almost 100% of my 512MB of RAM is in use at any given time. I am quite baffled by this, because I really am not running very much.

I usually run KDE, xmms, Firefox, amsn, a few basic applets (clock, kweather, pager), 2 desktops, and a ssh/ftp daemon.

In my opinion that should NOT use up 500 MB of RAM! I am wondering if you all have some tips for reducing the amount of memory being consumed. Here is a snapshot from top:

Code:
2672 root      15   0  118m  54m  51m S  6.6 10.8 235:55.30 X
21860 boyer     15   0 18428  11m 7920 S  2.3  2.2  23:01.23 wish
30635 boyer     15   0  127m  62m  31m S  1.7 12.3  11:34.99 firefox-bin
 2764 boyer     15   0 80084  29m  30m S  0.7  6.0  32:22.53 kdeinit
 2802 boyer     15   0 97004 7588 9576 S  0.3  1.5   1:51.70 xmms
 2816 boyer     15   0 28528 7480  25m S  0.3  1.5   3:26.84 kdeinit
 9395 root      16   0  2172 1048 1964 R  0.3  0.2   0:00.51 top
    1 root      16   0  1580  228 1424 S  0.0  0.0   0:02.72 init
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0
    3 root       5 -10     0    0    0 S  0.0  0.0   0:00.67 events/0
    4 root       5 -10     0    0    0 S  0.0  0.0   0:00.38 kblockd/0
    5 root      15   0     0    0    0 S  0.0  0.0   0:00.08 kapmd
    6 root      15   0     0    0    0 S  0.0  0.0   0:00.06 pdflush
    7 root      15   0     0    0    0 S  0.0  0.0   0:00.35 pdflush
    8 root      15   0     0    0    0 S  0.0  0.0   0:02.96 kswapd0
    9 root      10 -10     0    0    0 S  0.0  0.0   0:00.00 aio/0
   11 root      21   0     0    0    0 S  0.0  0.0   0:00.00 kseriod
   15 root      22   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
   16 root      15   0     0    0    0 S  0.0  0.0   0:00.00 ahc_dv_0
  147 root      16   0  2032  500 1588 S  0.0  0.1   0:00.48 devfsd
  236 root      15   0     0    0    0 S  0.0  0.0   0:00.00 khubd
  504 root      15   0     0    0    0 S  0.0  0.0   0:02.35 kjournald
  860 root      16   0  1652  228 1480 S  0.0  0.0   0:02.19 ifplugd
  923 root      15   0  2128  524 1788 S  0.0  0.1   0:00.08 dhclient
As you can see, that doesn't quite add up to 500 mb.

Any imput/further questions are welcome! Thanks!
 
Old 12-31-2004, 04:17 AM   #2
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 47
well, KDE is somewhat of a memory hog..........on my linux from scratch install.......KDE uses 75-80 megs minimum........and If I use the GIMP.....or any Graphics intensive program........memory use goes UP^^^^.............
 
Old 12-31-2004, 04:25 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
you spent your own hard earned money on 512mb of RAM. would you rather that only 200mb of this was used, and the rest just sat there gathering cobwebs, or have all the available space used with potentially useful information, that can be dropped instantly if the space becomes required.

linux uses up physical memory deliberately. look into the full memory model for more information.

as to actually using les ram in the first place... don't use kde.
 
Old 12-31-2004, 04:43 AM   #4
Zuggy
Member
 
Registered: Mar 2004
Location: Pocatello, Idaho, USA
Distribution: Ubuntu
Posts: 256

Rep: Reputation: 30
If you don't want to use so much memory, try using a lighter GUI like, Fluxbox, IceWM or XFCE (my current favorite, although this usually changes weekly and sometimes daily). Also only use 1 desktop instead of 2.

However, if your not noticing any slowdown I wouldn't worry about it or look into getting more RAM. How Linux is designed, it makes sure all your physical memory is in use before resorting to SWAP. In contrast (if I remember correctly) Windows tries to keep a certain amount RAM open so programs load faster, but the problem with this model is that they usually run slower. I would rather have a program take longer to load and have actual speed, then have a program open quickly and have the illusion of speed.
 
Old 12-31-2004, 04:43 AM   #5
Boyer
Member
 
Registered: Oct 2004
Location: Saint John, New Brunswick, Canada
Distribution: Mandrake 10.0 w/ KDE 3.3.1
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks Chris. Good insight.

I'd like to get away from KDE and all it's terrible problems, but I can't seem to find anything in the middle. All the desktop systems I've seen are either bloated, or too minimal. I don't know what else to try.
 
Old 12-31-2004, 07:48 AM   #6
BruceCadieux
Member
 
Registered: Apr 2002
Location: Wales MA.
Distribution: openSuSE 11.1
Posts: 409

Rep: Reputation: 32
To reduce memory useage, open case, remove 256 module, reboot computer. It will no longer use 500 megs.

I am at a loss to understand why people put memory in a computer if they do not want to use that memory.

The more you add, the more it will use, this is a good thing, not a bad thing.

Memory that is doing nothing, is useless, if it isn't "memorizing"data it is not doing what it was designed to do.

So I have to ask, if you don't want to use 512 megs of memory, then why install that much?
 
Old 01-01-2005, 08:14 PM   #7
Boyer
Member
 
Registered: Oct 2004
Location: Saint John, New Brunswick, Canada
Distribution: Mandrake 10.0 w/ KDE 3.3.1
Posts: 42

Original Poster
Rep: Reputation: 15
It's not that I don;t want to use it. It's that I don't want to be running virtually nothing, filling up almost all of it, and then not be able to play Unreal Tournament or open several large files with Gimp or something you know? I guess it hasn't really been a problem as such. I was just concerned about a memory leak somewhere. Not to mention, I'm trying to squeeze as much preformance out of my system as possible.
 
Old 01-01-2005, 08:54 PM   #8
BBB
Member
 
Registered: Aug 2004
Location: sweden
Distribution: Slackware 10.2 and Win2k
Posts: 127

Rep: Reputation: 15
I totally agree with Boyer, i need my RAM for games,
image editing et.c. I didn't buy my RAM chip so that some
bloated KDE-crap would fill it up (i still don't understand
how KDE can consume so enourmes amounts of memory).
This is why i use XFCE (fluxbox is to ugly).

And saying that Linux should deliberately fill up memory
to avoid "waste" is like saying that programs should fill up
my 200 GBs HD with meaningless "information" to avoid
"waste".
 
Old 01-01-2005, 09:24 PM   #9
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
Quote:
Originally posted by BBB
I totally agree with Boyer, i need my RAM for games,
image editing et.c. I didn't buy my RAM chip so that some
bloated KDE-crap would fill it up (i still don't understand
how KDE can consume so enourmes amounts of memory).
This is why i use XFCE (fluxbox is to ugly).

And saying that Linux should deliberately fill up memory
to avoid "waste" is like saying that programs should fill up
my 200 GBs HD with meaningless "information" to avoid
"waste".
so play your games and linux will free up the memory needed. and using up memory is not the same as having random junk fill up your hard drive. well, if you're a windows user, it is considering windows will swap to hard drive even if you have available memory (XP that is). there's a reason why you want to load things into memory, and it's called speed. memory i/o is always faster than hard drive i/o. not saying you shouldn't have the memory to play your games or do your graphic design, but your analogy is braindead. linux will free up needed memory (if possible).
 
Old 01-01-2005, 09:50 PM   #10
BBB
Member
 
Registered: Aug 2004
Location: sweden
Distribution: Slackware 10.2 and Win2k
Posts: 127

Rep: Reputation: 15
Will it will free it up, or just dump it on the swap? And how
long does it take to free up the memory? Why does it
use so much memory in the first place? I don't notice *any*
difference between when i have just started my system
and theres only 70 MB in use and when there is 200 MB
in use after 30 minutes of computer use. Also i don't register
this increased memory consumption in gPS (graphical
Top clone), just in the XFCE mem-monitor. This is a bit
funny, where does this unregistered mem go?

Even though i close Opera, Konqueror, restart the X-server
et.c. there is still approx. 100 MB of unregistered mem usage.

Also there seems to be a memory leak in Slackware 10, even though i have just started
the system 95% of the RAM is in use and most of it is unregistered :S .

Last edited by BBB; 01-01-2005 at 09:53 PM.
 
Old 01-01-2005, 10:14 PM   #11
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
Quote:
Originally posted by BBB
Will it will free it up, or just dump it on the swap? And how
long does it take to free up the memory? Why does it
use so much memory in the first place? I don't notice *any*
difference between when i have just started my system
and theres only 70 MB in use and when there is 200 MB
in use after 30 minutes of computer use. Also i don't register
this increased memory consumption in gPS (graphical
Top clone), just in the XFCE mem-monitor. This is a bit
funny, where does this unregistered mem go?

Even though i close Opera, Konqueror, restart the X-server
et.c. there is still approx. 100 MB of unregistered mem usage.

Also there seems to be a memory leak in Slackware 10, even though i have just started
the system 95% of the RAM is in use and most of it is unregistered :S .
just because top shows you having only a certain amount of memory free, doesn't mean that's what's really free. linux uses 4 types of memory (your memory is "broken" up into 4 different types) - user, shared, buffers, and cache. if you want to know why there's descrepency between what top (console usage program) is showing as free memory available and your gui app, subtract out the memory "usage" of buffers and cache in top. linux will only use swap if there is absolutely no memory left. buffers and cache are only used when applications need them. that is a good thing since memory i/o is a lot faster than hard drive i/o. linux stores data in buffers and cache for possible later use. having high mem usage in buffers and cache doesn't hurt you at all and is considered free memory (as you saw in your graphical usage app). you need to be aware of high mem usage of user and shared memory types.

here's the output of top for my computer:

Quote:
8:10pm up 1:02, 2 users, load average: 0.02, 0.02, 0.05
67 processes: 63 sleeping, 4 running, 0 zombie, 0 stopped
CPU states: 1.3% user, 0.5% system, 0.0% nice, 98.0% idle
Mem: 514344K av, 481580K used, 32764K free, 0K shrd, 14652K buff
Swap: 1052216K av, 0K used, 1052216K free 295444K cached
this says i only have 32 MB of memory free of 512 MB of total ram. but looking at cache (295 MB) and buffer (14 MB) gives a total of 309 MB of buffer and cache which added to free memory shown by top is 341 MB. That is almost exactly what shows up as free memory when i look at gkrellm (and other system usage programs). just because top ( or some other system console program) shows buffers and cache showing usage, doesn't mean it's actually being used at all. buffer and cache are normally only used when you start up applications and your application needs the memory.

Last edited by megaspaz; 01-01-2005 at 10:17 PM.
 
Old 01-01-2005, 11:26 PM   #12
BBB
Member
 
Registered: Aug 2004
Location: sweden
Distribution: Slackware 10.2 and Win2k
Posts: 127

Rep: Reputation: 15
Aha, so thats how it works. So when progams need more
memory the kernel just gives the memory blocks of the
least important buffers? Isnt this a potential security threat?
I mean if there is classified information in the buffers then
non-root programs can accses this info if it isn't cleaned
before given to the programs (which would use valuable
CPU-time).

I really need to study the Linux kernel, any links to tech
papers about the kernel?

Anyway thx for the info, it explains alot .
 
Old 01-17-2005, 02:54 PM   #13
sgrayban
Member
 
Registered: Nov 2004
Location: Spokane, WA
Distribution: Debian 6.0
Posts: 369

Rep: Reputation: 30
In a nut shell memory is delegated by the kernel when a program needs it. This can be in a GUI env or just a console env. It doesn't care. As stated before linux will use all memory before the swap because memory is faster.

What linux does is move memory if its not being used at that moment to swap if a another program needs that memory.
 
Old 01-17-2005, 03:20 PM   #14
shengchieh
Member
 
Registered: Jul 2004
Location: Palo Alto, CA
Distribution: #! Korora
Posts: 472

Rep: Reputation: 30
From a recent article, I understand that Gentoo and Slackware
are among the fastest. If you want speed, you might consider
switching. Although Mandrake and Xandros (which I use) are
more user-friendly.

Sheng-Chieh
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
process memory consumption ilnli Linux - General 4 09-08-2005 07:13 PM
Determine process memory consumption ? shayer009 Linux - General 1 10-28-2004 02:03 PM
Slackware memory consumption muhkuhmasta Slackware 5 07-15-2004 05:51 AM
high memory consumption and slow speed ryancw Linux - Newbie 1 03-24-2004 09:10 PM
gnome: huge memory consumption s56vpe Linux - Newbie 5 01-18-2004 07:37 PM


All times are GMT -5. The time now is 12:28 AM.

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