Memory leak in Gtk::Window



I appear to be unable to recover the memory from a Gtk::Window object after deleting it.

The following tiny program creates a new window every 2 seconds and then destroys it. The program grows by ~3MB each iteration.

What am I missing here?

#include <gtkmm.h>
#include <iostream>

using namespace std;


class Win : public Gtk::Window
{
public:
        Win()
        {
                set_size_request(1024, 768);
                realize();
        }

        ~Win()
        {
                cerr << "Destroying window" << endl;
        }
};



int
main(int argc, char* argv[])
{
        Gtk::Main App(argc, argv); 

        while (true) {
                Win* w = new Win;
                if (Gtk::Main::events_pending())
                        Gtk::Main::iteration();
                ::sleep(2);
                delete w;
        }

        exit (0);
}



      


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