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

implement buffer pool for message decoding #1

Open
noot opened this issue Jan 22, 2023 · 0 comments
Open

implement buffer pool for message decoding #1

noot opened this issue Jan 22, 2023 · 0 comments

Comments

@noot
Copy link
Contributor

noot commented Jan 22, 2023

Currently, the library allocates a new buffer for every incoming message (ie. every call to ReadStreamMessage) which may allocate a buffer up to length max(uint32), if that's what's passed by the caller. This is bad because many successive or concurrent reads can cause us to run out of memory resulting in a program crash. Also memory allocation uses a lot of CPU, which may be an issue depending on the application.
The library should only allocate up to a certain amount of buffers, and add them to a pool for re-use. The maximum size/amount of buffers should be configurable by the user of the lib.

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

No branches or pull requests

1 participant