
There are 5 tests that leak references that are present in 2.4.3c1, but not on HEAD. It would be great if someone can diagnose these and suggest a fix. test_doctest leaked [1, 1, 1] references test_pkg leaked [10, 10, 10] references test_pkgimport leaked [2, 2, 2] references test_traceback leaked [11, 11, 11] references test_unicode leaked [7, 7, 7] references test_traceback leaks due to test_bug737473. n

Hi Neal, On Sun, Mar 26, 2006 at 11:39:50PM -0800, Neal Norwitz wrote:
test_pkg leaked [10, 10, 10] references
This one at least appears to be caused by dummy (deleted) entries in the dictionary of interned strings. So it is not really a leak. It is a pain that it is so hard to figure this out, though. Wouldn't it make sense to find a trick to exclude these dummy entries from the total reference count? E.g. by subtracting the refcount of the dummy object... A bientot, Armin

Armin Rigo <arigo@tunes.org> writes:
Hi Neal,
On Sun, Mar 26, 2006 at 11:39:50PM -0800, Neal Norwitz wrote:
test_pkg leaked [10, 10, 10] references
This one at least appears to be caused by dummy (deleted) entries in the dictionary of interned strings. So it is not really a leak.
It's actually because somewhere in the bowels of compilation, the file name being compiled gets interned and test_pkg writes out some temporary files and imports them. If this doesn't happen on the trunk, did this feature get lost somewhere?
It is a pain that it is so hard to figure this out, though. Wouldn't it make sense to find a trick to exclude these dummy entries from the total reference count? E.g. by subtracting the refcount of the dummy object...
Something like that would be nice, yes... Cheers, mwh -- GET *BONK* BACK *BONK* IN *BONK* THERE *BONK* -- Naich using the troll hammer in cam.misc

Hi Michael, On Sat, Apr 01, 2006 at 02:54:25PM +0100, Michael Hudson wrote:
It's actually because somewhere in the bowels of compilation, the file name being compiled gets interned and test_pkg writes out some temporary files and imports them. If this doesn't happen on the trunk, did this feature get lost somewhere?
I guess it's highly non-deterministic. If the new strings happen to take a previously-dummy entry of the interned strings dict, then after they die the entry is dummy again and we don't have an extra refcount. But if they take a fresh entry, then the dummy they become afterwards counts for one ref. A bientot, Armin.

Neal Norwitz wrote:
test_unicode leaked [7, 7, 7] references
This one is lacking this checkin: r41530 | neal.norwitz | 2005-11-24 23:00:56 +0100 (Do, 24 Nov 2005) | 6 lines Geänderte Pfade: M /python/trunk/Lib/test/test_unicode.py Move registration of the codec search function to the module scope so it is only executed once. Otherwise the same search function is repeated added to the codec search path when regrtest is run with -R and leaks are reported. :-) Applying it gets the number of leaked references down to 1. Regards, Martin

Neal Norwitz wrote:
test_unicode leaked [7, 7, 7] references
And the last one came from r41531 | neal.norwitz | 2005-11-24 23:09:18 +0100 (Do, 24 Nov 2005) | 1 line Geänderte Pfade: M /python/trunk/Python/codecs.c M /python/trunk/Python/compile.c M /python/trunk/Python/symtable.c Fix a few more ref leaks. Backport candidate Only codecs.c backported, so this is what I did. Regards, Martin

Hi all, On Sun, Mar 26, 2006 at 11:39:50PM -0800, Neal Norwitz wrote:
There are 5 tests that leak references that are present in 2.4.3c1, but not on HEAD. It would be great if someone can diagnose these and suggest a fix.
test_doctest leaked [1, 1, 1] references test_pkg leaked [10, 10, 10] references test_pkgimport leaked [2, 2, 2] references test_traceback leaked [11, 11, 11] references test_unicode leaked [7, 7, 7] references
test_traceback leaks due to test_bug737473.
A follow-up on this: all the tests apart from test_traceback are due to the dummy object in dictionaries. I modified the code to ignore exactly these references and all the 4 other tests no longer leak. I'm about to check in this nice time saver :-) For information, the 2.5 HEAD now reports the following remaining leaks: test_generators leaked [1, 1, 1, 1] references test_threadedtempfile leaked [-85, 85, -85, 85] references test_threading_local leaked [34, 40, 26, 28] references test_urllib2 leaked [-66, 143, -77, -66] references A bientot, Armin
participants (4)
-
"Martin v. Löwis"
-
Armin Rigo
-
Michael Hudson
-
Neal Norwitz