Re: Memory problem

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

 



Don't know if this will solve your problem but I found:

"gdk_color_alloc is deprecated and should not be used in newly-written
code. Use gdk_colormap_alloc_color() instead."

My guess is that gdk_color_alloc allocates memory which isn't being freed up
and thus accumulates, but I didn't dig very deep.  This might also happen
with the newer function.

Ed James

On Wed, Mar 4, 2009 at 4:23 PM, maeda <maeda@xxxxxxxxxxxx> wrote:
> Hi Folks
>
> I have a function which is eating up lots of memory. The function is
> listed below and is called every 1 second with the same
>
> GtkWidget *widget
>
> being passed to it each time.
> What do I need to do to stop it eating up memory. All I want the
> function to do is set the colours of itself and its parent(if it has one).
> Any help greatly appreciated.
>
>
>
> int SetWidgetColour(GtkWidget *widget, int bordersize, int red,
> int green, int blue)
> {
> GtkStyle *new_style;
> GdkColor color;
>
> color.red = red;
> color.green = green;
> color.blue = blue;
>
> gdk_color_alloc(gdk_colormap_get_system(), &color);
> new_style = gtk_style_copy(gtk_widget_get_default_style());
> new_style->bg[GTK_STATE_NORMAL] = color;
> new_style->bg[GTK_STATE_PRELIGHT] = color;
> new_style->bg[GTK_STATE_ACTIVE] = color;
> gtk_style_detach (widget->style);
> gtk_widget_set_style(GTK_WIDGET(widget), new_style);
>
> return TRUE;
> }
>
> --
> Atsushi Maeda
>
> 2-10-22 Mukaibara Asao-ku
> Kawasaki-shi Kanagawa-ken
> 215-0007 JAPAN
>
> Mail1: maeda@xxxxxxxxxxxx
> Mail2: assio.maedario@xxxxxxxxxxxx
> Phone: +81-80-5532-0156
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux