-
Notifications
You must be signed in to change notification settings - Fork 269
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
reuse buffer #453
reuse buffer #453
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 work, thank you @marbar3778 and LGTM!
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.
totally forgot about this issue. Thanks for handling it.
getting a stack overflow in tests, any idea @odeke-em |
I just remembered that some of these functions return a byte slice []byte that'll be alive for who knows how long. However, we return buf.Bytes() which returns the raw underlying buffer. Looks like that's causing the problem. You can fix this by doing what I did here tendermint/tendermint#7325 and it'll still be much cheaper than creating and discarding a bytes.Buffer. |
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.
LGTM++ and thank you @marbar3778!
* reuse buffer * copy bytes (cherry picked from commit 0568d39)
closes #371
cc @odeke-em