Re: [gtk-list] Memory Management
- From: Havoc Pennington <hp redhat com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Memory Management
- Date: 22 Mar 2000 11:16:07 -0500
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]