Re: [gtk-list] gdk_color_alloc memory leak?



Hi Douglas

I have the same problem as yours with gtk+-1.0.6. It seems it is either a too
difficult problem or a too easy one as it's not the first time this appears in
this mail-list. And as I never see any response...
I'm using GdkGC to have lot of different colors, so each time I make a
"gdk_gc_new" then I tried unref, destroy, free, ... Nothing that works.
My app refresh every seconds, so there is rapidly a great amount of memory
used ! (+4 ko each time !!!)

It's not helping but you're not alone   ;-)

Patrick

P.S.: sorry for my bad english

J Douglas Winters wrote:

> 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



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