Remove COUNT_ALLOCS special build

Hi,
I would like to confirm that there is no user of the Python "COUNT_ALLOCS" special build, because I plan to remove it from Python 3.9. If you use it, please raise your hand and explain why other debug tools don't fit your specific use case.
--
I'm always annoyed by "#ifdef COUNT_ALLOCS" code which is common in code related to reference counting (object.h, object.c, typeobject.c). It makes the code harder to read and harder to maintain. It's a 27 years old feature which always required to rebuild Python with COUNT_ALLOCS macro defined. In clear, you have to know about the feature and build your own Python binary to use it.
COUNT_ALLOCS was used for 6 years (2010-2015) in the debug build of Python of the Fedora package. Sadly, C extensions provided by Fedora are only built in release mode, and so cannot be used by the debug build. python2.7-debug requires to rebuild all C extensions in debug mode. IMHO nobody ever used python2.7-debug to debug real applications.
The feature was added to Fedora debug build by Dave Malcolm in 2010 to help him to debug memory leaks. Later, he wrote: "I don't think this patch ever really bought us much, and it sounds like there are better tools for this now, so feel free to drop the COUNT_ALLOC patches." So the feature was dropped from Python 3 package in 2015.
I never ever used this feature. I consider that there are now way better tools to debug memory leaks in Python 3, like tracemalloc and multiple tools based on gc.get_objects().
I failed to find any user of COUNT_ALLOCS on the Internet. I'm quite sure that many core developers never heard about this special build.
I proposed https://bugs.python.org/issue39489 and https://github.com/python/cpython/pull/18259 to remove the feature. My PR basically only removes code:
34 files changed, 24 insertions(+), 470 deletions(-)
Do you see any reason to keep COUNT_ALLOCS in Python 3.9? If yes, please elaborate :-)
Victor

----- Original Message -----
From: "Victor Stinner" vstinner@python.org To: "Python Dev" Python-Dev@python.org Sent: Wednesday, January 29, 2020 10:57:02 PM Subject: [Python-Dev] Remove COUNT_ALLOCS special build
Hi,
I would like to confirm that there is no user of the Python "COUNT_ALLOCS" special build, because I plan to remove it from Python 3.9. If you use it, please raise your hand and explain why other debug tools don't fit your specific use case.
--
I'm always annoyed by "#ifdef COUNT_ALLOCS" code which is common in code related to reference counting (object.h, object.c, typeobject.c). It makes the code harder to read and harder to maintain. It's a 27 years old feature which always required to rebuild Python with COUNT_ALLOCS macro defined. In clear, you have to know about the feature and build your own Python binary to use it.
COUNT_ALLOCS was used for 6 years (2010-2015) in the debug build of Python of the Fedora package. Sadly, C extensions provided by Fedora are only built in release mode, and so cannot be used by the debug build. python2.7-debug requires to rebuild all C extensions in debug mode. IMHO nobody ever used python2.7-debug to debug real applications.
The feature was added to Fedora debug build by Dave Malcolm in 2010 to help him to debug memory leaks. Later, he wrote: "I don't think this patch ever really bought us much, and it sounds like there are better tools for this now, so feel free to drop the COUNT_ALLOC patches." So the feature was dropped from Python 3 package in 2015.
I never ever used this feature. I consider that there are now way better tools to debug memory leaks in Python 3, like tracemalloc and multiple tools based on gc.get_objects().
I failed to find any user of COUNT_ALLOCS on the Internet. I'm quite sure that many core developers never heard about this special build.
I proposed https://bugs.python.org/issue39489 and https://github.com/python/cpython/pull/18259 to remove the feature. My PR basically only removes code:
34 files changed, 24 insertions(+), 470 deletions(-)
Do you see any reason to keep COUNT_ALLOCS in Python 3.9? If yes, please elaborate :-)
Victor
Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/YEY2TZIW... Code of Conduct: http://python.org/psf/codeofconduct/
I've never used this feature and it was quite the hassle to maintain those patches downstream, so in my biased opinion, I would welcome the removal.
participants (2)
-
Charalampos Stratakis
-
Victor Stinner