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

ByteArrayReaderWriter allocating a lot of memory #11

Open
void050 opened this issue Oct 25, 2017 · 2 comments
Open

ByteArrayReaderWriter allocating a lot of memory #11

void050 opened this issue Oct 25, 2017 · 2 comments

Comments

@void050
Copy link

void050 commented Oct 25, 2017

Hello Alan! Thanks for your work)
Sorry for my english(

Call a WriteBuffer for an array[2048] allocate 10.5 kb memory.
So when i tryied to send a message to a client every client.SendPayload allocated about 30 kb,
30 kb * 30 times/second * 100 players = 87 mb per second.

After changing ByteArrayReaderWriter to Array.copy and creating a broadcast method for a client allocating 1.7 kb or 3.7 kb(idk why, packets is identical). But it still allocating 8 mb per second.
Unity3d 2017, memory check in profiler

@void050
Copy link
Author

void050 commented Oct 25, 2017

Unfortunately 1 kb allocated in AEAD_Chacha20_Poly1305.Encrypt

@GlaireDaggers
Copy link
Owner

You are correct - I've already noticed the allocations happening within BouncyCastle and resolved them, have just been too busy to actually upload them.
A push to fix this should be available today. Based on my profiling, it should eliminate all but one allocation (and that one remaining allocation is in Socket.SendTo and cannot be fixed)

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

2 participants