gdk_color_alloc memory leak?



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
===========================================



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