Memory leak in Tkinter.py ?
Dr. Peter Stoehr
peter.stoehr at weihenstephan.org
Wed Jul 28 13:18:33 EDT 1999
Hi Python-Fans,
Greg McFarlane (the developer of Pmw) and I found a memory leak in
Tkinter.py of Python 1.5.2.
The tag_bind method of the Canvas class maintainece a dict called
self._tagcommands to store lists of function-ids returned from the _bind
call.
As far as I can see, this information not used by any other method.
Furthermore, the lists grow with every call of tag_bind and the memory
is never released.
After removing the
if sequence and func and res:
block of the tag_bind method, the memory consumption of the enclosed
test program is constant and no longer growing.
Is it okay to remove the
if sequence and func and res:
block or did I miss something?
Greetings
Peter
#########################################################################################
import Tkinter
def callback(event):
pass
def autoUpdate():
buttonId = canvas.bind('<ButtonPress>', callback)
canvas.unbind('<ButtonPress>', buttonId)
root.after(10, autoUpdate)
root = Tkinter.Tk()
canvas = Tkinter.Canvas(root)
idn = canvas.create_rectangle(100,100,200,200, fill='green')
canvas.pack()
autoUpdate()
root.mainloop()
##########################################################################################
--
---------------------------------------------------------------------------
Dr. Peter Stoehr --- Teisenbergweg 6 --- 85435 Erding --- 08122/47232
---------------------------------------------------------------------------
I'm the terror that flaps in the night
More information about the Python-list
mailing list