Re: GtkLabel question



On Mon, May 19, 2003 at 12:42:50PM -0300, Lucas Di Pentima wrote: 
> It's weird, memprof tells me that there's a memory leak when I do some
> thing like:
> 
> - ------------------------------------------------------------
> GtkLabel *label;
> gint i;
> ...
> gtk_label_set_text(label, g_strdup_printf("%d", i));
> - ------------------------------------------------------------
> 
> If gtk_label_set_text() copies the string, isn't the string generated
> with g_strdup_printf() freed automatically?

No. C is not garbage collected, nor does it have destructors.  You
have to understand and manage malloc(), free(), and pointers
explicitly.

Havoc



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