-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Use ExchangeHandle to track ref count of ExchangeContext #7125
Conversation
Size increase report for "nrfconnect-example-build" from ebd9e0a
Full report output
|
Size increase report for "gn_qpg6100-example-build" from ebd9e0a
Full report output
|
For what it's worth, I am currently working on a redesign of exchange context lifetime semantics that aims to fix these same issues. Just making things shared_ptr-like does not actually fix all the lifetime problems we have, as far as I can tell. We might want to have some sort of handle setup in addition to the semantic changes; still sorting that out. Importantly, we need to make it much harder to get the |
IMHO, |
I am probably OK with decoupling Close() and the reference counting. But one of our major lifetime issues is "someone is holding on to this for too long", and having a shared_ptr doesn't, on its own, help with that. What helps is knowing when you actually need to hold a reference. So to be clear, doing this sort of thing may well make sense, but is not enough on its own. To actually fix the issues we are running into with exchange lifetime we need, imo, some more general changes to how exchange lifetime is managed. I am trying to get those changes together in the next few days; we should just coordinate the changes because they are touching a lot of the same code. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This stale pull request has been automatically closed. Thank you for your contributions. |
Problem
#7124
#6978
#7012
#6918
This PR is going to fix
ExchangeContext
life-cycle management problem once for allChange overview
Introduce a shared_ptr like
ExchangeHandle
to automatically track the ref counter ofExchangeContext
to replace raw pointer ofExchangeContext
.Testing
Not yet, make it draft first.