[Patches] [ python-Patches-1524639 ] Fix Tkinter Tcl-commands memory-leaks

SourceForge.net noreply at sourceforge.net
Wed Jul 19 12:33:34 CEST 2006


Patches item #1524639, was opened at 2006-07-18 17:00
Message generated for change (Comment added) made by grahamh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1524639&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Graham Horler (grahamh)
Assigned to: Martin v. Löwis (loewis)
Summary: Fix Tkinter Tcl-commands memory-leaks

Initial Comment:
Fix 8 memory-leaks by cleaning up created Tcl commands
automatically.

I attach a patch against Tkinter 47021.

=== Long explanation ===

I was bitten by a memory leak in Tkinter - 25MB per day
on a long-running process.  A net search found a couple
unrelated Tkinter leaks, and gave me some clues. 
Investigation using the tracing feature in tkleak.py
(see link) found the bug.

I searched for more similar leaks, and fixed them too.

The reasoning for patch #1121234 gives the reason for
the changes to _register() and deletecommand().

See http://www.uk.debian.org/~graham/python/tkleak.py
for my leak tracing and test script.


----------------------------------------------------------------------

>Comment By: Graham Horler (grahamh)
Date: 2006-07-19 11:33

Message:
Logged In: YES 
user_id=543663

I fixed a bug in the original patch: when destroying a
window which had Variable instances attached which in turn
had trace commands bound, Tkinter.py was trying to delete
the commands twice, as the command was mentioned in Variable
instance _tclCommands and _root()._tcl_Commands.

Also fixed 4 more leaks occurring when TclError is raised
after a callback has been created.

I have added 6 tests to tkleak.py to test the additional 4
fixes.

The patch is against 50704, hope it helps.

Thanks for your hard work, and for accepting my other
Tkinter.py patch.


----------------------------------------------------------------------

Comment By: Graham Horler (grahamh)
Date: 2006-07-18 17:18

Message:
Logged In: YES 
user_id=543663

The python version I am using in production is 2.1 (for
historical reasons), however the memory leak bugs are in 2.1
through to 2.5.

I can generate a patch against any of the older versions
(e.g. 2.4) if anyone is interested.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1524639&group_id=5470


More information about the Patches mailing list