Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

leaking like sieve 1

Status
Not open for further replies.

tanderso

IS-IT--Management
Aug 9, 2000
981
US
I'm running Mandrake 9.0 with Gnome, Nautilus, and Mozilla, among other apps of course. Everything seems to be leaking memory as if the whole system needs its gaskets changed. I notice it immediately after I run common programs like Nautilus and Mozilla that the memory is not freed-up completely. After about a week, my 768M of physical memory is at its limit and it starts hitting my swap disk. At the point that my swap disk (only 128M since I have so much physical memory) gets around half-full, some programs begin misbehaving. Sometimes killing the offending programs brings back the memory, but sometimes it's Gnome or X itself, or sometimes I can't even figure out where the memory went... it's just gone. If I close down all programs so that it is in the state that I started X, then still 90% of my RAM is allocated. And even after I log out of X and log back in, still 60% of my memory is being used as opposed to only 18% when I boot into X fresh from a system restart.

Does anyone know where all the memory is going? Is there a single offender that I can patch or change the settings on or something? This is getting very reminiscent of Windows. Please don't suggest a different window manager, as that is my last resort (if it would even help), but I really like Gnome. Any ideas? Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Where are you getting these figures about memory from?.....does everything run slowly?
 
I use gnome-system-monitor and top to track how much memory is allocated, free, and reserved by which programs. Nothing runs slowly until RAM is used up and it starts hitting the swap disk, and as I said, as soon as the swap disk starts getting full, some programs freeze or crash. Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
---I'm running Mandrake 9.0 with Gnome, Nautilus, and Mozilla, among other apps of course.

You do know that Gnome eats up a ton of resources, right?

---Everything seems to be leaking memory as if the whole system needs its gaskets changed. I notice it immediately after I run common programs like Nautilus and Mozilla that the memory is not freed-up completely.

You're right. They arent. If you have shared Libraries on your system (100% sure), the kernel caches the system shared libs into memory. So if you're running a bunch of GTK 2.0 based apps, load time is a bit faster. Also you can pretty much upgrade everything if you just upgrade the base libs. Of course, it eats memory.

Now take what I said about the GTK libs. Now if you run a KDE program, KDE libs are in memory. Now if you run a motif program (adobe pdf viewer and the like), now the motif libs are in memory. See how this alone can eat up ram?

---After about a week, my 768M of physical memory is at its limit and it starts hitting my swap disk. At the point that my swap disk (only 128M since I have so much physical memory) gets around half-full, some programs begin misbehaving. Sometimes killing the offending programs brings back the memory, but sometimes it's Gnome or X itself, or sometimes I can't even figure out where the memory went... it's just gone. If I close down all programs so that it is in the state that I started X, then still 90% of my RAM is allocated. And even after I log out of X and log back in, still 60% of my memory is being used as opposed to only 18% when I boot into X fresh from a system restart.

Damn. Thrashing on .75 gig ram? There is one other thing I can think of.. Linux likes to cache device transfers to ram (like writing stuff to the HD). Say if you're copying a file from /ev/hda1 to /dev/hdb1 (both physical hard drives) and the file is 100MB. What Linux'll do is read the file as fast as it can, cache it to memory and wait for the other device, so it can slowly write the data. If you try this with a floppy and a 1 MB file, copy it and see how "fast" it is. Then unmount it.

There's a way to stop this behavior. It involves adding to the /etc/fstab the SYNC option on all drives that you want the above situation NOT to happen.


/dev/fd0 /mnt/floppy auto user,noauto,sync 0 0

---Does anyone know where all the memory is going? Is there a single offender that I can patch or change the settings on or something? This is getting very reminiscent of Windows. Please don't suggest a different window manager, as that is my last resort (if it would even help), but I really like Gnome. Any ideas?

First, my tastes are with KDE/windowmaker/Enlightenment, but if you like Gnome, here's some tips. DO NOT RUN non-gtk GUI programs. Once those dynamic libs are loaded in, they dont often come out. The only other options are to add sync to the HD's, or buy more ram. Still, I've only got .5 GB of ram, and my swap doesnt thrash like that .....

Still, I havent used Mandrake much, except the earlier versions. It just didnt go very well for me at all. My first was RH 5.0, then I went to Slackware. My dad bought a copy of Mandrake, but I didnt like it. I then went to Debian. The console installer's not very pleasent to use, but is WONDERFUL to use in general. And if you stay with the stable branch, your system will be as stable as a rock.
 
The following is the top 35 memory hogs from "ps axv" after running for about a week (the remaining 20-30 processes are all under 2M RSS each):
Code:
PID   TTY      STAT   TIME   MAJFL   TRS   DRS      RSS   %MEM  COMMAND
 6360 ?        SL     10:10  33267   1491  295356   29396  3.7  /etc/X11/X :0 -defergl
 6422 ?        S       0:06   3882    602   36877   16308  2.1  nautilus --sm-config-pr
 6482 ?        S       0:00      0    602   36877   16308  2.1  nautilus --sm-config-pr
 6483 ?        S       0:00      1    602   36877   16308  2.1  nautilus --sm-config-pr
 6484 ?        S       0:00      3    602   36877   16308  2.1  nautilus --sm-config-pr
 6485 ?        S       0:00     14    602   36877   16308  2.1  nautilus --sm-config-pr
 6488 ?        S       0:00      1    602   36877   16308  2.1  nautilus --sm-config-pr
 6489 ?        S       0:00      0    602   36877   16308  2.1  nautilus --sm-config-pr
 6490 ?        S       0:00      0    602   36877   16308  2.1  nautilus --sm-config-pr
 6491 ?        S       0:00      0    602   36877   16308  2.1  nautilus --sm-config-pr
22900 ?        S       0:00   1944    112   30483   16004  2.0  /usr/lib/gweather-apple
22901 ?        S       0:00      0    112   30483   16004  2.0  /usr/lib/gweather-apple
22902 ?        S       0:00     73    112   30483   16004  2.0  /usr/lib/gweather-apple
22903 ?        S       0:00     10    112   30483   16004  2.0  /usr/lib/gweather-apple
22904 ?        S       0:00      0    112   30483   16004  2.0  /usr/lib/gweather-apple
23469 ?        S       0:00      0    112   30483   16004  2.0  /usr/lib/gweather-apple
 6424 ?        S       0:22   2607    440   18643   12048  1.5  gnome-panel --sm-config
 6426 ?        S       0:02   2003     39   14600    8496  1.0  /usr/lib/multiload-apple
 6653 ?        S       0:09   1499    758   21605    7380  0.9  wombat --oaf-activate-ii
 6420 ?        S       1:17   1884    377   14838    7352  0.9  metacity --sm-save-file 
22470 ?        S       0:00   1655     15   15472    6904  0.8  /usr/lib/nautilus-throbb
 6411 ?        S       0:02   1600     92   14635    6872  0.8  gnome-settings-daemon --
32446 ?        S       0:00   1417     39   17480    6144  0.7  gnome-spell-component-0.
 6365 tty1     S       0:01   3104     85   14766    5600  0.7  gnome-session
 6675 ?        S       0:00   1314    100   18971    5504  0.7  evolution-alarm-notify -
  985 ?        S       0:32    266     72    7231    4344  0.5  xfs -port -1 -daemon -dr
 6657 ?        S       0:03    916     21    9874    4248  0.5  bonobo-moniker-xmldb --o 
 6401 tty1     S       0:00    576     48    5875    4076  0.5  /usr/lib/gconfd-2 11
25762 ?        S       0:00   1139      1    6534    3616  0.4  /usr/bin/Eterm
 9266 ?        S       0:00     80    244    6367    2684  0.3  httpd -DPERLPROXIED -DHA
 9263 ?        S       0:00     57    244    6355    2576  0.3  httpd -DPERLPROXIED -DHA
 9264 ?        S       0:00     57    244    6355    2576  0.3  httpd -DPERLPROXIED -DHA
 9265 ?        S       0:00     57    244    6355    2576  0.3  httpd -DPERLPROXIED -DHA
24575 ?        S       0:00     57    244    6355    2576  0.3  httpd -DPERLPROXIED -DHA
 1782 ?        S       0:00  12102    244    6167    2444  0.3  httpd -DPERLPROXIED -DHA
RSS TOTAL: 370208

And the following is after a fresh boot:
Code:
PID   TTY      STAT   TIME    MAJFL  TRS   DRS      RSS   %MEM  COMMAND
 2220 ?        SL      0:01   3454   1491  284000   19508  2.5  /etc/X11/X :0 -defergl
 2288 ?        S       0:01   2762    602   31157   15132  1.9  nautilus --sm-config-pr
 2291 ?        S       0:00      0    602   31157   15132  1.9  nautilus --sm-config-pr
 2292 ?        S       0:00      9    602   31157   15132  1.9  nautilus --sm-config-pr
 2293 ?        S       0:00      1    602   31157   15132  1.9  nautilus --sm-config-pr
 2294 ?        S       0:00      1    602   31157   15132  1.9  nautilus --sm-config-pr
 2297 ?        S       0:00      0    602   31157   15132  1.9  nautilus --sm-config-pr
 2290 ?        S       0:00   2348    440   16743   10600  1.3  gnome-panel --sm-config
 2277 ?        S       0:00   1586     92   17499    9720  1.2  gnome-settings-daemon --
 2301 ?        S       0:00   1891    112   21451    8788  1.1  /usr/lib/gweather-applet
 2302 ?        S       0:00      0    112   21451    8788  1.1  /usr/lib/gweather-applet
 2303 ?        S       0:00     82    112   21451    8788  1.1  /usr/lib/gweather-applet
 2304 ?        S       0:00      0    112   21451    8788  1.1  /usr/lib/gweather-applet
 2305 ?        S       0:00      0    112   21451    8788  1.1  /usr/lib/gweather-applet
 2231 tty1     S       0:00   3094     85   14778    7916  1.0  gnome-session
 2286 ?        S       0:00   1833    377   14658    7824  1.0  metacity --sm-save-file 
 2299 ?        S       0:00   1747     39   13832    7472  0.9  /usr/lib/multiload-apple
 1857 ?        S       0:00     15      8    8251    5984  0.7  /usr/bin/perl /usr/share
  982 ?        S       0:00    166     72    5363    4056  0.5  xfs -port -1 -daemon -dr
 1765 ?        S       0:00     52    569    6986    4032  0.5  httpd-perl -f /etc/httpd
 1766 ?        S       0:00     52    569    6986    4032  0.5  httpd-perl -f /etc/httpd
 1767 ?        S       0:00     52    569    6986    4032  0.5  httpd-perl -f /etc/httpd
 1777 ?        S       0:00     52    569    6986    4032  0.5  httpd-perl -f /etc/httpd
 2267 tty1     S       0:00    574     48    5735    3948  0.5  /usr/lib/gconfd-2 11
 1764 ?        S       0:00    113    569    6854    3944  0.5  httpd-perl -f /etc/httpd
 2309 ?        S       0:00   1021      1    6310    3352  0.4  /usr/bin/Eterm
 1136 ?        S       0:00     42      8    4499    2984  0.3  /usr/bin/perl /usr/sbin/
 1784 ?        S       0:00     58    244    6307    2676  0.3  httpd -DPERLPROXIED -DHA
 1785 ?        S       0:00     58    244    6307    2676  0.3  httpd -DPERLPROXIED -DHA
 1801 ?        S       0:00     58    244    6307    2676  0.3  httpd -DPERLPROXIED -DHA
 1802 ?        S       0:00     58    244    6307    2676  0.3  httpd -DPERLPROXIED -DHA
 1779 ?        S       0:00    302    244    6119    2548  0.3  httpd -DPERLPROXIED -DHA
 2275 ?        S       0:00    635     18    7261    2524  0.3  gnome-smproxy --sm-confi
 2273 ?        S       0:00    529     72    3959    2224  0.2  /usr/lib/bonobo-activati
 1611 ?        S       0:00      3    195   12140    2212  0.2  /usr/bin/prelude -qd -P
RSS TOTAL: 258380

Now, clearly we can see that many programs have grown in resident size over the course of a week. This alone is alarming. However, this doesn't even come close to accounting for the "missing" memory. Recall that I have 768M of system memory and 128M of swap. The "full" system has only 10% of system memory and 50% of swap free whereas the "new" system has 82% of system memory and 100% of swap free. The fact that the "full" system goes immediately to swap illustrates that for all intents and purposes, system memory is in fact gone. But where to? I'm not sure what the DRS number is (data/stack?), but that doesn't make sense because it is more than my RAM and swap combined.

I'll try the "sync" solution, but I don't think that is the problem. It's worth a try though. I also found this bugzilla report: but I don't know whether that is similar or not.

Any additional suggestions would be welcome! BTW, why does there have to be so many instances of Nautilus, the weather applet, and others? I understand the need to have multiple web server instances, but why these other programs? Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
First, X doesnt worry me in the least. Also, considering the bug in reporting how much memory is allocated to X is system memory+Graphics ram. Of course, what X windows does, 3.7% of your ram (minus your graphics ram) is totally understandable, because you probably have tons of modules plugged into it. Each one of those eats memory, and usually are critical.

Second what really concerned me is that weather applet. Check this page for commenstt on recent mem leak fixes:


I'd upgrade or kill this applet depending how well you like it.

Also, do you have many file manager windows open? That's why you have soo many nautilus programs. Each one is a seperate instance. Please let Tek-Tips members know if their posts were helpful.
 
Actually, I routinely kill the weather app, as I already knew that had a pretty major leak. But every time I do, it seems to give back the memory... you think maybe some is lost every time? I kill it about once a day to reclaim memory. I'm pretty sure I'm running the latest version. As for the file manager... it is also used to draw the desktop, but I don't usually have more than one instance open at the same time. Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
---But every time I do, it seems to give back the memory... you think maybe some is lost every time?

Unless it is a bug with the kernel memory alloc section itself (on the realm of 99.9999% doubt) when you kill any program, it releases all memory associated to it.

The only time when memory leaks occur like this is when there's bugs with a user space program.

Still, I just dont understand why you're having to deal with this.. Something just isnt right, and I'm not sure what it can be.

Sorry,
Josh Please let Tek-Tips members know if their posts were helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top