dwgui leaks

Robin Becker <[email protected]> Sat, 9 Nov 2002 10:37:19 +0000
Newsgroups gmane.comp.python.anygui.devel
Message-ID <[email protected]>
I have a working backend in dwgui, but it leaks in the pump loop somewhere.
I used a minimal window only thing and then just rapidly moving the mouse over
the window makes the memory rise. A similar test with mswgui doesn't use more.

How should one debug this kind of leak? Can using a specially compiled debug
python help?

#test script
from anygui import *
app = Application()
win = Window(title="A Standard Window", x=50, y=650, width=220, height=45)
app.add(win)
app.run()



The main action is taking place in the pump loop

        def internalRun(self):
                if _verbose: log('internalRun:Begin',str(self))
                class MSG(structob.struct_object):
                        oracle = structob.Oracle (
                                'windows message',
                                'Nlllllll',
                                ('hwnd',
                                 'message',
                                 'wParam',
                                 'lParam',
                                 'time',
                                 'x',
                                 'y')
                                )
                msg = MSG()
                while user32.GetMessage(msg, 0, 0, 0): #pump loop
                        try:
                                if _verbose: log('internalRun: loopstart',msg)
                                user32.TranslateMessage(msg)
                                user32.DispatchMessage(msg)
                                log('internalRun: loopend')
                        except:
                                logTraceback(None)
                log('internalRun: finish')


and the Dispatch goes through the window proc

        def _wndproc(self, hwnd, msg, wParam, lParam):
                if _verbose: log("%s._wndproc called with %s,%s,%s,%s"%(self.__class__.__name__,hex(hwnd),hex(msg),hex(wParam),hex(lParam)))
                try:
                        window = self.widget_map[hwnd]
                except:
                        if _verbose: log("\tNO WINDOW TO DISPATCH???")
                        return user32.DefWindowProc(hwnd, msg, wParam, lParam)
                _dispatch = self._dispatch.get(msg,_dispatch_DEFAULT)
                x = _dispatch(window,hwnd,msg,wParam,lParam)
                if _verbose: log("\tdispatch %s to %s %s\n" % (_dispatch.__name__[9:],window.__class__.__name__,window),"\t ==>",x)
                return x

with the dispatches going to the default ie

def _dispatch_DEFAULT(window,hwnd,msg,wParam,lParam):
        return user32.DefWindowProc(hwnd, msg, wParam, lParam)

-- 
Robin Becker


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf