Application memory grows uncontrollably and crashes



Hi all!

I have a simple Gtk+ application developed using Glade and GtkAda.

Unfortunately, the memory consumption rises relentlessly until the
machine "crashes" :(

The FAQ says that GTK+/Glib doesn't leak memory:
http://www.gtk.org/faq/#AEN666

but a small application of a couple of thousand lines using
very little memory itself should reach a stable (small) limit of memory
consumption.  This is not so for my application, or "gtk-demo" either.

I have read numerous reports in the list archive of possible memory leaks,
but the general response seems to be that it is working as designed.
I have not managed to find a viable solution to this very real problem.

Currently, my application has to be restarted daily to allow the machine to
survive.  Otherwise, the program Size/RSS rises to way over 1GB, and the
total RAM+Swap is exhausted.  The computer then takes a ten minute (!) break,
kills a few processes and, if I'm lucky, continues.  Since this machine
runs hard real-time software on a mission critical project, I cannot tolerate
limitless memory consumption.

How do I set a limit to the memory consumption of a Gtk+ program?
What code should my program contain to prevent this erroneous behavior?
Do I need switches to allow garbage collection?
(do these solutions work on things like mozilla, which commonly use > 800MB RSS?)

Since this problem also seems to arise with gtk-demo, mozilla, and others, I don't
think it is a simple coding error in my application.

The most interesting thing I found on the issue was from Havoc:
http://mail.gnome.org/archives/gnome-list/1999-April/msg02117.html
but this doesn't seem to give viable solutions in my case.

> If you are getting slowdowns, then you need to trim functionality
This is barely more than a "hello world" application I've got!

> If you just can't give up functionality, buy more RAM.
OK. But I'm gonna be max'ed out on RAM soon!  This machine only takes 3.5GB :(

My compilation line includes the following:

-I/usr/local/include/gtkada -largs -L/usr/local/include/gtkada -L/usr/local/lib
-lgtkada -Wl,--export-dynamic -L/usr/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0

I am using RedHat Linux 7.3 on 2xAMD Athlon, 2GB RAM + 2GB Swap with packages:
gtk2-2.2.1-4.i386.rpm
glib2-2.2.1-1.i386.rpm

Thank you for listening!
--
Dr Adrian Wrigley,
Cambridge, England.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]