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
Remove parser reference to break the cyclic reference to protocol #1604
Conversation
… let garbage colletor to do it's work
What about h11? |
h11 frees up memory as expected after the |
Btw mypy is not super happy about setting the parser to |
I'm going to review this in a few hours. If confirmed, I'll create a follow-up release. Thanks @humrochagf 🙏 |
I still have the leak. 😗 |
Ok, maybe we have 2 different issues. One that is directly related to I'm attaching here the memory profiles that I made for this fix, with a before fix and after fix profiles (4 in total because I ran in memray in normal mode with pymalloc and another in leak mode with malloc). And this is my pip freeze output:
I'll try to run with a fresh env to see if I get the same leak that you are still getting. But in case I don't get the leak, could you please send me your pip freeze output to compare them? |
Here are the files |
Alright, I found the second point of leak 🎉 But when I started a new venv without uvloop I noticed it was still leaking. Now if you check for references to in both protocols at the end of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @humrochagf :)
* Remove parser reference to break the cyclic reference to protocol and let garbage colletor to do it's work * Unset keepalive after closing transport
* Remove parser reference to break the cyclic reference to protocol and let garbage colletor to do it's work * Unset keepalive after closing transport
This removes the reference to the parser after losing connection so during the teardown of the protocol there will be no cyclic ref to it freeing up the object to be collected by the garbage collector.
Fixes #1564