Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow disabling automatic full collection when computing growth #61

Open
71FIL opened this issue May 31, 2021 · 1 comment
Open

allow disabling automatic full collection when computing growth #61

71FIL opened this issue May 31, 2021 · 1 comment

Comments

@71FIL
Copy link

71FIL commented May 31, 2021

I recently experienced a manifestation of https://bugs.python.org/issue39061 which I had worked around by running a full collection (gc.collect()) at regular intervals. I started using objgraph to try to find the source of the "leak" (the reference cycle) which moved and accumulated objects in the generation 2 collection which also made the issue disappear, just as my regular garbage collection was. I thus assumed that objgraph was calling gc.collect() and indeed it was.

I commented out the call to gc.collect() in growth which allowed me to identify the reference cycle which I could fix using weakrefs.

I would like to propose a new option to the growth/show_growth functions to disable the automatic full collection. Maybe running a generation 1 collection or none at all even if it means that there would be more false positive showing up in the growth report.

This is a proposition and I will gladly do the change if it sounds like it would be useful.

By the way, objgraph has helped me more than once at this point. Thank you very much.

@mgedmin
Copy link
Owner

mgedmin commented Jun 1, 2021

Huh, that's an interesting use case.

I would accept such a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants