-
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
Reduce memory usage by using rref instead of move-copy #6874
Conversation
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.
Nice result! :)
@kghost Sadly a conflict now, sorry :( |
Size increase report for "nrfconnect-example-build" from 805a4b3
Full report output
|
@kpschoedel Just FYI here. Given the .text savings I guess we should do it, but this is making a pretty major behavior change to a lot of functions (which used to actually null out the buffer pointer in the caller and now don't, or do but only sometimes). @kghost what auditing did you do to make sure all the callers are OK with that behavior change, and what safeguards to we have in place against testing only situations when the pointer is not nulled out and later then ending up in a case when it is? |
And to be clear, that is exactly where we are after this PR: a bunch of test shims have the "don't null it out" behavior, while their real-code counterparts would probably null it out. |
Using rvalue reference can save a call to move constructor.
This PR is trying to replace some arguments of
PacketBufferHandle
to rvalue reference, in order to check if we can save memory.