Re: [gtk-list] Memory Management




Jon Keating <jonkeating@norcom2000.com> writes:
> I have some questions about memory management.. I couldn't find any
> specific item in the tutorial or FAQ about it.
> 
> I'm using g_strdup_printf(...) to create my title..
> gchar *title = g_strdup_printf(...);
> 
> Is it ok to g_free(title); at the bottom of this function?  And I have
> some structures that I create with g_new0(...) do I need to g_free()
> it as well?
> I'm just concernted about my program having memory leaks that can be
> avoided.
> 
> Any advice or direction to a document will be greatly appreciated.
> 

Yes you need to g_free() both of these. 

A good book on C, or looking at enough C source code, will give you a
sense of how to manage memory.

Havoc



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