Re: Memory
- From: Havoc Pennington <hp redhat com>
- To: martyn 2 russell bt com
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Memory
- Date: 07 Feb 2002 10:31:00 -0500
martyn 2 russell bt com writes:
If I set the text on a label or a text box, do I need to free any memory?
Similarly if I set a pixmap to a new image, do I need to free the original
pixmap and/or should I free the new pixmap I created (i.e. does set_pixmap
create a copy and use that?)
set_pixmap adds a reference. So you have to remove your own reference.
set_text() will copy the string.
It's very rare (only one deprecated exception I can think of) that GTK
will "take over" ownership of a resource from you; typically it adds
its own reference, or makes a copy, and you have to unref/free your
copy.
With the subtlety of the floating refcount for GtkObject of course,
see GtkObject docs.
Havoc
- References:
- Memory
- From: martyn . 2 . russell
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]