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

Get rid of extra memory allocations related to NetMessage:s in MP games #4172

Open
ManManson opened this issue Jan 8, 2025 · 0 comments
Open
Assignees

Comments

@ManManson
Copy link
Member

There's a constant stream of memory allocations coming from networking layer in MP games. These allocations can be traced to NetMessage instances, each of which has a vector<uint8_t> to store the message payload.

This behavior can be easily observed by profiling heap allocations with any applicable tool (for example: perf, HeapTrack, or MSVC's builtin profiling tools) while running a WZ process.

It probably makes sense to provide a custom allocation strategy for the message payload data (e.g. a memory pool-based allocator/arena allocation or dynamically growing circular buffer).

Also, there's a chance that some NetMessage copies can be avoided (but I'm not yet sure about that), so an additional investigation should be conducted to either prove or disprove that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant