Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_tcl memory leak #64942

Closed
pitrou opened this issue Feb 23, 2014 · 7 comments
Closed

test_tcl memory leak #64942

pitrou opened this issue Feb 23, 2014 · 7 comments
Assignees
Labels
performance Performance or resource usage stdlib Python modules in the Lib dir tests Tests in the Lib/test dir topic-tkinter

Comments

@pitrou
Copy link
Member

pitrou commented Feb 23, 2014

BPO 20743
Nosy @pitrou, @serhiy-storchaka

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/pitrou'
closed_at = <Date 2014-02-23.18:48:05.630>
created_at = <Date 2014-02-23.17:13:45.924>
labels = ['library', 'tests', 'expert-tkinter', 'invalid', 'performance']
title = 'test_tcl memory leak'
updated_at = <Date 2014-02-23.18:48:05.629>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2014-02-23.18:48:05.629>
actor = 'pitrou'
assignee = 'pitrou'
closed = True
closed_date = <Date 2014-02-23.18:48:05.630>
closer = 'pitrou'
components = ['Library (Lib)', 'Tests', 'Tkinter']
creation = <Date 2014-02-23.17:13:45.924>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 20743
keywords = []
message_count = 7.0
messages = ['212006', '212012', '212013', '212016', '212017', '212018', '212019']
nosy_count = 3.0
nosy_names = ['pitrou', 'python-dev', 'serhiy.storchaka']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'resource usage'
url = 'https://bugs.python.org/issue20743'
versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

@pitrou
Copy link
Member Author

pitrou commented Feb 23, 2014

Witnessed on 2.7, 3.3, 3.4:

$ ./python -m test -uall -R3:3 test_tcl 
[1/1] test_tcl
beginning 6 repetitions
123456
......
test_tcl leaked [12, 12, 12] references, sum=36
test_tcl leaked [5, 5, 5] memory blocks, sum=15

@pitrou pitrou added stdlib Python modules in the Lib dir topic-tkinter performance Performance or resource usage labels Feb 23, 2014
@pitrou
Copy link
Member Author

pitrou commented Feb 23, 2014

This actually appeared with 89b738e3d0c9, i.e. it's not a regression but an existing leak that was uncovered by a new test.

@pitrou
Copy link
Member Author

pitrou commented Feb 23, 2014

Actually, this looks mostly like a cleanup issue in the tests. Following patch seems to solve it:

diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -376,6 +376,7 @@ class TclTest(unittest.TestCase):
             result = arg
             return arg
         self.interp.createcommand('testfunc', testfunc)
+        self.addCleanup(self.interp.tk.deletecommand, 'testfunc')
         def check(value, expected, eq=self.assertEqual):
             r = self.interp.call('testfunc', value)
             self.assertIsInstance(result, str)

@pitrou pitrou added the tests Tests in the Lib/test dir label Feb 23, 2014
@serhiy-storchaka
Copy link
Member

LGTM.

There is a little related but more complex bpo-1524639.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Feb 23, 2014

New changeset 38a06e411698 by Antoine Pitrou in branch '3.3':
Issue bpo-20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/38a06e411698

New changeset 10b1f60a72fa by Antoine Pitrou in branch 'default':
Issue bpo-20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/10b1f60a72fa

@python-dev
Copy link
Mannequin

python-dev mannequin commented Feb 23, 2014

New changeset 00393de6919d by Antoine Pitrou in branch '2.7':
Issue bpo-20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/00393de6919d

@pitrou
Copy link
Member Author

pitrou commented Feb 23, 2014

Ok, fixed now.

@pitrou pitrou closed this as completed Feb 23, 2014
@pitrou pitrou added the invalid label Feb 23, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage stdlib Python modules in the Lib dir tests Tests in the Lib/test dir topic-tkinter
Projects
None yet
Development

No branches or pull requests

2 participants