This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eric.snow, pablogsal, phsilva, vstinner
Date 2019-11-21.10:15:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I reopen the issue, the change introduced a reference leak :-( Example:

$ ./python -m test -R 3:3 test_atexit -m test.test_atexit.SubinterpreterTest.test_callbacks_leak
0:00:00 load avg: 1.12 Run tests sequentially
0:00:00 load avg: 1.12 [1/1] test_atexit
beginning 6 repetitions
test_atexit leaked [3988, 3986, 3988] references, sum=11962
test_atexit leaked [940, 939, 940] memory blocks, sum=2819
test_atexit failed

== Tests result: FAILURE ==

1 test failed:

Total duration: 466 ms
Tests result: FAILURE

It seems like each _testcapi.run_in_subinterp("pass") call leaks 3988 references.

I tried tracemalloc to see where the memory allocation are done, but tracemalloc reports a single Python line: the _testcapi.run_in_subinterp() call...

I tried to follow the increase of references using a watchpoint in gdb on _Py_RefTotal, but it takes a lot of time to follow each Py_INCREF/Py_DECREF knowning that we are talking aobut around 4,000 references.
Date User Action Args
2019-11-21 10:15:44vstinnersetrecipients: + vstinner, phsilva, eric.snow, pablogsal
2019-11-21 10:15:44vstinnersetmessageid: <>
2019-11-21 10:15:44vstinnerlinkissue36854 messages
2019-11-21 10:15:44vstinnercreate