I have a memory leak problem with a program that uses the OnIdle function. I
have written a small test program that shows the problem. I am using Windows
98 and Python 2.0. I check the amount of free memory with "Windows 95 Memory
Monitor".
from wxPython.wx import *
ID_START = 101
ID_STOP = 102
class TestDlg(wxDialog):
def __init__(self, parent):
wxDialog.__init__(self, parent, -1, "Testing in progress")
self.stop = wxButton(self, ID_STOP, "Stop",wxPoint(50, 50))
self.stop.SetDefault()
self.Finished = 0
self.Stop = 0
EVT_BUTTON(self, ID_STOP, self.OnStop)
EVT_IDLE(self, self.OnIdle)
def OnIdle(self, event):
if not self.Finished:
if self.Stop:
self.Finished = 1
self.Close(true)
else:
event.RequestMore()
def OnStop(self, event):
self.Stop = 1
class MainFrame(wxFrame):
def __init__(self, parent, ID, title):
wxFrame.__init__(self, parent, ID, title,
wxDefaultPosition)
self.SetBackgroundColour(wxColor(250,240,220))
b = wxButton(self, ID_START, "Start", wxPoint(300, 400))
EVT_BUTTON(self, ID_START, self.OnClick)
def OnClick(self, event):
dlg = TestDlg(self)
dlg.Show(true)
dlg.ShowModal()
dlg.Destroy()
class MyApp(wxApp):
def OnInit(self):
frame = MainFrame(NULL, -1, "Test")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
As soon as I click on the "Start" button, the free memory is decreasing
endless. When I click on the "Stop" button, the free memory remains stable.
Any idea ?
Thanks for your help
Jean-Claude Repetto
Vallauris, France
···
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users