whos to free what mem?
- From: Andreas Leitner <nozone sbox tugraz at>
- To: gtk-app-devel-list gnome org
- Subject: whos to free what mem?
- Date: Wed, 05 May 2004 11:31:07 +0200
Hi,
I am developing GTK bindings for the language Eiffel and am currently
investigating who needs to free what memory with respect to strings.
In the following scenario:
---
GtkWidget *button;
char* label_text = ...; // somehow init that text
printf ("label text: %x\n", label_text);
button = gtk_button_new_with_label (label_text);
printf ("get_text: %x\n", gtk_button_get_label (GTK_BUTTON(button)));
---
I can see that gtk_button_new_with_label actually copies the string
since the first and the second printf show two different memory
locations.
* Now am I correct when assuming that if I have dynamically allocated
the memory for 'label_text', it is my duty to free that memory again?
* Is this true for all the string handling in GTK? Are strings always
copied, and I always need to free them? Or are there exceptions? If so
is there documentation who needs to free what where and when? (;
many thanks in advance,
Andreas
--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]