[wxPython] Memory leak (still)...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[wxPython] Memory leak (still)...

Sam Pumphrey

Dear all,

FYI, the wxImage colour problem seems to be a big/little endian problem,
and fixable only within wxwindows, so lets hope to see that in the next
release.
The scrolling problems from last month about OnPaint called twice in
wxGTK seems to have been fixed in the new version, too.

However, I still have (increasingly worrying) memory leakage problems,
which only occur in unix... (hopefully indicating that my code is ok :)

Consider the following small program:

#------------------------------------------------------------------------
# import all of the wxPython GUI package
from wxPython.wx import *

class MyTimer(wxTimer):
    def __init__(self,frame):
        wxTimer.__init__(self)

    def Notify(self):
        pass


class MyFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title,
                         wxPoint(100, 100), wxSize(500, 300))

        self.timer=MyTimer(self)
        # stupidly short interval time to accelerate memory leak
problem:
        self.timer.Start(20)

    def OnCloseWindow(self,evt):
        self.timer.Stop()
        del self.timer
        self.Destroy()

############################################################################
# Main procedure....

if __name__ == "__main__":
    class MyApp(wxApp):
        def OnInit(self):
            self.frame = MyFrame(NULL, -1, "Memory Leak Tester")
            self.frame.Show(true)

            self.exiting = FALSE;
            return true

    app = MyApp(0)     # Create an instance of the application class
    app.MainLoop()     # Tell it to start processing events
   
#------------------------------------------------------------------------

All this does is have a timer, which does nothing. When the program is
run (in unix), I find that every 10 seconds, the size grows by 32 Kb...
And it's not *doing* anything.. :-(

Furthermore, if you actually remove the timer, too, so all you have is a
frame, sitting and doing nothing, then it still loses 8 Kb every 10
seconds!!

(This may not seem much, but it's 3MB an hour, and if programs are
running for days, as I'd like, then it all adds up pretty quickly!)

Now, this probably (?) isn't a wxpython problem, and may lie with wxGTK,
but I thought I'd get your views on the matter first.

I think it's slightly disturbing that this sort of thing might not have
been noticed by the wxgtk developers!

Any ideas on what might be causing the problems would be gratefully
received.

TIA,

Sam

------------------------------------------------------
   Sam Pumphrey - Project SPIRIT, AT&T Research UK
 Email: [hidden email] - Tel: (01223) 343215
------------------------------------------------------

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Loading...