FizzySteamworks icon indicating copy to clipboard operation
FizzySteamworks copied to clipboard

Runtime memory allocation optimizations

Open Metater opened this issue 11 months ago • 2 comments

Use ArraySegment and buffers allocated at startup to avoid runtime memory allocations.

To any reviewers:

  1. Is zeroing the messagePtr arrays in NextClient.cs and NextServer.cs necessary?
  2. Is the commented out code inside of ProcessMessage() in NextCommon.cs a good way of handling oversize packets or should it stay the way it is?

Thanks!

Metater avatar Jan 08 '25 06:01 Metater

By reusing the same buffer for receiving, I created a bug when messages are queued up before the connection fully begins. So all of the queued up messages keep overwriting each other, because they are not processed immediately, as they are normally.

I am working on a fix now where the queued up data is copied to new arrays.

Metater avatar Jan 11 '25 22:01 Metater

The issue should be fixed now

Metater avatar Jan 11 '25 22:01 Metater

@Chykary Hey, just want to make sure you see this. Thanks!

Metater avatar Jul 18 '25 04:07 Metater

Thank you and sorry for the delay! Github mails always end up in spam folder for me, got to fix that..

Chykary avatar Jul 22 '25 09:07 Chykary