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 Kevin Mills
Recipients Kevin Mills
Date 2017-02-27.20:35:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488227712.23.0.994684569809.issue29671@psf.upfronthosting.co.za>
In-reply-to
Content
The intro paragraph for the gc module's documentation says:

> Since the collector supplements the reference counting already used in Python, you can disable the collector if you are sure your program does not create reference cycles.

How would you ever be sure of that?

While you can prevent reference cycles in your own code, what about your dependencies? You'd have to look through the code of all of your dependencies and transitive dependencies (including the standard library) to verify that none introduce reference cycles. And then you'd have to redo that work when upgrading any of them.

I propose adding a function to the gc module that returns True if the gc has reclaimed at least one reference cycle in the course of the current program's execution.

With that, it would be possible to, a program could, before it exits, force a collection and then check if any reference cycles were found over the program's lifetime, and then the programmer could use that information to decide whether they can safely turn off the gc or not.

Obviously that wouldn't guarantee that you could safely turn of the gc (it's possible that garbage with reference cycles is created on other runs of the program) it would at least be some information.
History
Date User Action Args
2017-02-27 20:35:12Kevin Millssetrecipients: + Kevin Mills
2017-02-27 20:35:12Kevin Millssetmessageid: <1488227712.23.0.994684569809.issue29671@psf.upfronthosting.co.za>
2017-02-27 20:35:12Kevin Millslinkissue29671 messages
2017-02-27 20:35:11Kevin Millscreate