[C++-sig] Memory leaks in Python embedded in wxWindows

Dmitri Mouromtsev dimour at mail.ru
Thu Sep 23 15:06:31 CEST 2004


Hello all,

I am using Python embedded in wxWindows application. And I've found
memory leaks even in empty applications. There is an example of such
application below. Without wxWindows there are no memory leaks.

Sample wx program:

wxWindows v. 2.5.1
BOOST     v. 1.31
Python    v. 2.3.3

Compiled iv VC 7.1



#include "wx/wx.h"
#include "boost\python.hpp"

using namespace boost::python;

class MyFrame: public wxFrame
{
public:
        MyFrame::MyFrame()
        : wxFrame(NULL, -1, "Test")
        {
                Py_Initialize();
        }

        MyFrame::~MyFrame()
        {
                Destroy();
                Py_Finalize();
        }
};

class MyApp: public wxApp
{
public:
    bool OnInit()
        {
                MyFrame *frame = new MyFrame();
                frame->Show(TRUE);
                SetTopWindow(frame);
                return TRUE;
        }
};

IMPLEMENT_APP(MyApp)



Any suggestion would be appreciated.
Thanks.

-- 
Best regards,
 Dmitri                          mailto:dimour at mail.ru




More information about the Cplusplus-sig mailing list