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 vstinner
Date 2020-01-29.18:16:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580321776.5.0.0072987667606.issue39489@roundup.psfhosted.org>
In-reply-to
Content
Python has a COUNT_ALLOCS special build which adds sys.getcounts() function and shows statistics on Python types at exit if -X showalloccount command line option is used.

I never ever used this feature and I don't know anyone using it.

But "#ifdef COUNT_ALLOCS" code is scattered all around the code. It requires maintenance. I propose to remove the code to ease maintenance.

Attached PR shows how much code is requires to support this special build.

There are now more advanced tools to have similar features:

* tracemalloc can be used to track memory leaks
* gc.getobjects() can be called frequently to compute statistics on Python types
* There are many tools built around gc.getobjects()

The previous large change related to COUNT_ALLOCS was done in Python 3.6 by bpo-23034:

"The output of a special Python build with defined COUNT_ALLOCS, SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can be re-enabled using the -X showalloccount option. It now outputs to stderr instead of stdout. (Contributed by Serhiy Storchaka in bpo-23034.)"

https://docs.python.org/dev/whatsnew/3.6.html#changes-in-python-command-behavior
History
Date User Action Args
2020-01-29 18:16:16vstinnersetrecipients: + vstinner
2020-01-29 18:16:16vstinnersetmessageid: <1580321776.5.0.0072987667606.issue39489@roundup.psfhosted.org>
2020-01-29 18:16:16vstinnerlinkissue39489 messages
2020-01-29 18:16:16vstinnercreate