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

Better memory management #63

Open
pszturmaj opened this issue Feb 22, 2017 · 0 comments
Open

Better memory management #63

pszturmaj opened this issue Feb 22, 2017 · 0 comments

Comments

@pszturmaj
Copy link
Owner

See

msg = new ubyte[len];

This was supposed to be temporary, until I'd finish other parts, but stayed here until now. It needs to be rewritten to reuse the buffer if possible. I would leave it as is for big messages, with configurable threshold in bytes and for messages smaller than threshold I would reuse a growable buffer. This change should prevent many unnecessary allocations and is fairly simple to do.

A little more complex but better solution would be receiving a fixed size buffer, then consuming that buffer field by field, and when you read past end of the buffer it should refresh the buffer with new content under the hood.

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