[Python-3000] Leaks in py3k-pep3137 branch

Christian Heimes lists at cheimes.de
Fri Nov 9 16:22:24 CET 2007


Guido van Rossum wrote:
> Three tests fail when run with "regrtest.py -R::"
> 
> test_frozen
> test_pkg
> test_tcl

The three tests depend on behavior which isn't compatible with multiple
runs during a test session. The tests could be fixed when Python gains
are reliable way to unload modules and C extensions.


> test_ctypes

I've already talked to Thomas. He thinks it's not a reference leak.

$ ./python Lib/test/regrtest.py -R2:10 test_ctypes
[...]
test_ctypes leaked [9, 6, 2, 0, 0, 0, 0, 0, 0, 0] references, sum=17

$ ./python Lib/test/regrtest.py -R5:5 test_ctypes
[...]
test_ctypes leaked [0, 33, 0, 0, -33] references, sum=0

> test_pipes

test_pipes sometimes leaks 33 references on my system but usually it
recovers the 33 references in the next iteration.

$ ./python Lib/test/regrtest.py -R1:20 test_pipes
test_pipes
beginning 21 repetitions
123456789012345678901
.....................
test_pipes leaked [0, 0, 0, 0, 33, -33, 0, 0, 0, 0, 0, 0, 33, 0, -33, 0,
0, 33, -33, 0] references, sum=0

test_pipes leaked [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
33, -33, 0] references, sum=0

test_pipes leaked [0, 0, 0, 0, 0, 0, 0, 33, -33, 0, 0, 33, -33, 0, 0, 0,
0, 0, 0, 0] references, sum=0

test_pipes leaked [-33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0] references, sum=-33

test_pipes leaked [0, 0, 0, 0, 0, 33, -33, 0, 0, 0, 0, 0, 0, 0, 33, -33,
0, 0, 0, 0] references, sum=0

> test_urllib2_localnet

The test is leaking WeakSets and references to a function _remove which
seems to be the nested function _remove of WeakSet.

0x82e3034 [1] set()
0x8661494 [1] <weakref.WeakSet object at 0x8661494>
0x884cf4c [1] (<weakref at 0x82e9c34; to 'WeakSet' at 0x86616c4>,)
0x8847a2c [1] <function _remove at 0x8847a2c>
0x82e9c34 [1] <weakref at 0x82e9c34; to 'WeakSet' at 0x86616c4>
0x8648e94 [1] {'_remove': <function _remove at 0x8847a2c>, 'data': set()}


More information about the Python-3000 mailing list