allencook200
Member
- Joined
- Apr 27, 2021
- Messages
- 9
- Programming Experience
- 1-3
So I'm writing an online game using MessagePack and around every 20ms the server sends about 500 entities all serialized into a single object, to every client. No problem, except that every time it deserializes on each client, it seems like it creates 500 new objects, which is really killing my client's game when garbage collection hits.
That popup window showing "GC.Alloc" is only one GC allocation event. If you look closely, there's multiple red boxes that the profiler isn't showing data for. Literal tons of garbage.
JsonReceive = MessagePackSerializer.Deserialize<Json_ClientTickUpdate>(Message);
And here's the command that I'm running, once every around 20ms. If I get rid of that single line, the game runs fine. Surely there's a way to keep messagepack from creating so much garbage?
That popup window showing "GC.Alloc" is only one GC allocation event. If you look closely, there's multiple red boxes that the profiler isn't showing data for. Literal tons of garbage.
JsonReceive = MessagePackSerializer.Deserialize<Json_ClientTickUpdate>(Message);
And here's the command that I'm running, once every around 20ms. If I get rid of that single line, the game runs fine. Surely there's a way to keep messagepack from creating so much garbage?