Re: Will this create a memory leak? Can't determine from top.

Tristan Van Berkom wrote:
Bartek Kostrzewa wrote:

Should I define an array of char pointers
*message[TABLE_SIZE][TABLE_SIZE] to hold the pointers created by
g_strdup_printf or would that just be a waste of memory?

   I guess you want to free the string when the object emmiting the
signal is finalized, in that case you can use a function like
g_object_weak_ref like so:

Come to think of it, you can make it even simpler by just doing:

  g_object_weak_ref (G_OBJECT (button[i][j]),
                     (GWeakNotify)g_free, string);


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