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

Reduce stack usage in loop(). no data duplication on stack #173

Merged
merged 1 commit into from
Aug 21, 2016
Merged

Reduce stack usage in loop(). no data duplication on stack #173

merged 1 commit into from
Aug 21, 2016

Conversation

edwin-oetelaar
Copy link
Contributor

remove copy of topic string onto stack before giving it to callback()
Just move it one byte in buffer to add space for 'C' string end \0x00 same result, no stack needed.

topic string onto stack before giving it to callback()
Just move it one byte in buffer to add space for 'C' string end \0x00
@Suxsem
Copy link

Suxsem commented Jun 26, 2016

Umh -1, payload isn't always a string

@Suxsem
Copy link

Suxsem commented Jun 26, 2016

@edwin-oetelaar
Copy link
Contributor Author

Topic can not contain embedded '0x00' chars.
4.7.3 Topic semantic and usage
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718109
The fix reduces the stack usage, it no longer copies the full topic onto the stack.
I am not touching any other payload.
Please read the code before commenting.

@Suxsem
Copy link

Suxsem commented Jun 26, 2016

You're right I read payload instead of topic sorry.
I will review the proposal more carefully and report back here

@knolleary
Copy link
Owner

Looks sensible to me

@knolleary knolleary merged commit df41224 into knolleary:master Aug 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants