[Glade-users] GTK+ and Memory...

Damon Chaplin damon@ximian.com
Wed, 11 Apr 2001 17:52:08 -0400


Keith Minkler wrote:
> 
> Can someone point me to a reference document on how GTK+ uses memory..
> I've noticed that some things I cannot free after handing them to GTK+,
> and some things I can.. I can't recall offhand which was which, but I
> have crashed my application numerous times trying to free something that
> I thought was "my" memory, not GTK's.. for example, setting a text entry
> to some data, or a list.. when does GTK store a copy of the string I give
> it, and when does it use that string?  From my experience, it doesn't seem
> to be consistant, so I've not been freeing anything, which means I'm leaking =]

In general GTK+ copies all strings you pass to it.
Also, the API documentation should tell you if you need to free any
values
returned.

Though there are exceptions, so I usually check by reading the source
code.


   http://developer.gnome.org/doc/API/

Damon