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

[stream-mode branch] Add StreamEncoder.Close() to recycle buffer #392

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

fxamacker
Copy link
Owner

@fxamacker fxamacker commented Feb 28, 2023

StreamEncoder uses a buffer from sync.Pool, but that buffer was never returned to the pool for reuse.

This PR adds StreamEncoder.Close() to return buffer to the pool.

After calling StreamEncoder.Close(), all subsequent calls to encode return ErrStreamClosed error.

Updates: onflow/cadence#2157

@fxamacker fxamacker added the enhancement New feature or request label Feb 28, 2023
@fxamacker fxamacker self-assigned this Feb 28, 2023
@fxamacker fxamacker merged commit c0c9f77 into feature/stream-mode Feb 28, 2023
@fxamacker fxamacker deleted the fxamacker/add-streamencoder-close branch June 18, 2023 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant