-
Notifications
You must be signed in to change notification settings - Fork 55
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
Experiment with destructors, use them to cleanup peerinfo leaks #318
Conversation
I'd rather see a deterministic solution here - ie this is a bit of a trap in that the costs will show later |
I completely agree (set this PR as draft) but at same time the amount of issues to solve (which in turns generates more issues) increases. |
been thinking a bit and well, using this solution for now might allow us to focus on other issues... |
I see this as technical debt - the other work will be hampered by it - in .net, they added a construct in languages ( |
There might be a way to get both determinism and immunity to programming errors. Instead of creating a destructor for the heap allocated object, consider making a non-ref wrapper object that holds a reference to the heap object and automatically closes it through a destructor defined for the wrapper. This is similar to spirit to smart pointer types, Obviously, the feasibility of this depends on the way the |
the peerinfo is quite wildly shared as it stands - ie it's half-way reused and half-way created on demand even if other peerinfos exist for the peer - ie the future in it is not useful really - #320 addresses some of it by simply removing the future and adding tracking events that can be used to implement this in client code. |
#320 merged, this is obsolete |
This seems to fix the leaks,
I know destructors are controversial but they really get called on finalize and they seem to work.
Judge yourself here: