Memory leak in Tkinter.py ?

Tim Peters tim_one at email.msn.com
Wed Jul 28 22:27:55 EDT 1999


[Dr. Peter Stoehr]
> ...
> The tag_bind method of the Canvas class maintains 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.

Your analysis looks good to me, although the memory will be released when
the owning  Canvas instance goes away (which it never did in your test
program).

> ...
> Is it okay to remove the
> 	if sequence and func and res:
> block or did I miss something?

I think removing that block is fine.  The

	_tagcommands = None

at the start of the Canvas class should be removed too, then.

agreeably y'rs  - tim






More information about the Python-list mailing list