Re: [gtk-list] Gtk Text Widget memory leak?



On Sun, 14 Jun 1998 valankar@bigfoot.com wrote:

> 	Hello, I'm having a slight problem with GTK's Text widget in
> Linux. It seems when I add text to the widget, and then destroy it, the
> memory is not freed. I'm not sure of this, but what I did to test was load
> large files (kernel, etc) into the text widget, destroyed the widget,
> create a new text widget, load a large file, etc... and in the process
> doing a 'ps ux' to check memory usage. I've noticed that the %MEM field of
> the ps output rises considerably as each file is loaded and does not go
> down once the text widget is destroyed.
> 
> 	Is this normal? What should the proper way that a Text widget
> should be destroyed? Right now I am using gtk_widget_destroy on the dialog
> that contains the text widget (and have also tried destroying the actual
> text widget). Any help appreciated.

I've never tried this but I think you have to delete the text first, then
destroy the widget.  This is done with something like
	gtk_text_set_point(GTK_TEXT(txt), 0);
	gtk_text_forward_delete(GTK_TEXT(txt), -1); // -1, to end of text.
or something of that nature.

---
Matt Perry [guy@mikepery.linuxos.org]

Whistler's Law:
        You never know who is right, but you always know who is in charge.
---



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