[9871] in The GTK GIMP ToolKit mailing list archive
[gtk-list] gdk_color_alloc memory leak?
daemon@ATHENA.MIT.EDU (J Douglas Winters)
Thu Nov 5 00:08:00 1998
Date: Wed, 4 Nov 1998 22:07:50 -0700 (MST)
From: J Douglas Winters <winters@cs.utah.edu>
To: gtk-list@redhat.com
In-Reply-To: <Pine.GSO.3.95.981104174405.13000J-100000@harper.uchicago.edu>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
Hi, I've just begun learning how to use GTK, so if my question is brought
about by ignorance, my apologies. Anyway, the app I'm writing contains a
GtkDrawingArea. Drawing (pun not originally intended) from the scribble
tutorial I am using a GdkGC for drawing to the GtkDrawingArea. I need
to be able to draw in different colors, so here's how I do it:
/* this->color is a GdkColor which gets set up prior to this code */
/* this->canvas_widget is the GtkDrawingArea */
gdk_color_alloc(gtk_widget_get_colormap(this->canvas_widget),
&this->color);
gdk_gc_set_foreground(this->gc, &this->color);
(For the curious, this isn't C++, the "this" is an explicit pointer passed
to all of my (pseudo)member functions.)
Using gtk+-1.0.6, I monitor the system resources used by X (with top) and
as it reallocates (same) colors over and over, the memory usage of X
continually increases.
Using gtk+-1.1.3, the X resources remain steady as I expected them to in
the beginning.
So here's the question:
Am I doing something wrong which 1.1.3 corrects for, or is it a bug in
1.0.6? If it is, will it be fixed? I'd rather work in 1.0 since I'd
rather not develop on a moving target, but this problem eventually slows
it down too much. (BTW, you can duplicate the problem with GIMP by
loading and reloading a full-color image.)
Thanks.
--Doug
===========================================
J Douglas Winters | winters@cs.utah.edu
===========================================
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null