Problem with memory management with builder.
- From: Krzysztof Łochwinowicz <krzysztof lochwinowicz gmail com>
- To: gtkmm-list gnome org
- Subject: Problem with memory management with builder.
- Date: Wed, 15 Jun 2011 19:56:00 +0200
Hi *,
I was told that deleting a window object (created by gtk builder) will cause deletion of every window's child. Maybe I'm wrong but it looks like it does not.
Take a look on this small piece of code
[code]
int main(int argc, char** argv)
{
Gtk::Button* button;
{
Gtk::Main kit(argc, argv);
Gtk::Window* window;
Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
refBuilder->add_from_file("some.ui"); // with window and button
refBuilder->get_widget("window1", window);
refBuilder->get_widget("button1", button);
window->show_all();
kit.run(*window);
delete window;
} // builder dies here..
delete button; // Program exits normally, no double delete.
}
[/code]
Why it behave so? I run this program in a loop (100 times) and memory usage still increasing. Even valgrind shows definitely lost memory.
--
-----------------------------------------------------------
Krzysztof Łochwinowicz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]