-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
test_idle: idlelib.configdialog leaks references #75313
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
Comments
Starting at the following build, test_idle started to leak references: Example of leak: $ ./python -m test -R 3:3 -u all test_idle -m idlelib.idle_test.test_configdialog.FontPageTest.test_set_samples
(...)
test_idle leaked [2168, 2168, 2168] references, sum=6504
test_idle leaked [1152, 1154, 1155] memory blocks, sum=3461
(...) A bisection identified this commit: commit 9397e2a
|
I don't know anything about idlelib, but it seems like the following patch fixes the failing test: diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
index aff3c2f..9f495fd 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -41,6 +41,7 @@ def tearDownModule():
global root, dialog
idleConf.userCfg = usercfg
tracers.detach()
+ tracers.clear()
del dialog
root.update_idletasks()
root.destroy() Extract of ConfigDialog.create_page_highlight(): self.builtin_theme = tracers.add(
StringVar(parent), self.var_changed_builtin_theme) This method contains many tracers.add() calls, but tearDownModule() of Lib/idlelib/idle_test/test_configdialog.py only calls "tracers.detach()" and detatch() doesn't clear VarTrace.untraced list. |
Attached is an improved idlelib.idle_test.test_* leak checker that uses the --match option. |
I confirm that test_idle doesn't leak anymore: $ ./python -m test -R 3:3 -u all test_idle
1 test OK. |
The merged change is the correct fix. My change was only a workaround. Thanks for the fix Terry ;-) |
Victor: Something seems to have changed in the last few days. When I merged, both specific classes Today, not having touched configdialog or test_configdialog, test_configdialog as a whole passes but FontPageTest, IndentTest, and GenPageTest fail with Could any of your other recent changes to regrtest have introduced a spurious 1 block error when tests are filtered? |
While reference leaks are more or less stable, the check on memory blocks is fragile. I'm unable to reproduce your issue on Linux. I tested "./python -m test -R 3:3 -u gui -v test_idle". If you have a reproductible failure, please open a new issue since this one is closed. If you consider that it's a recent regression, you can go back in history using git checkout <old sha1>, or even git bisect. If you open a new issue, you may want to use "python -m test.bisect ..." to identify which test leaks memory blocks. |
My message was most a heads-up. As I said, I only get the 1 block leak with a micro test of a class or method. It is possible that even that is Windows-specific. As long as you only care that test_idle not leak, I don't care about this either. |
Yeah, again, the memory block check is fragile. It might be an legit internal cache filled for good reasons. It can be a free list. It can be a lot of things. It's really hard to track such very tiny memory allocation. "leaked [1, 1, 1, 1] memory blocks" can be a false alarm, it's not big. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: