Open cswiedler opened 7 years ago
It looks like this only happens with reliable messages; unreliable messages don't show the same behavior. We're going to switch to unreliable messages (we just haven't quite yet finished the higher-level support for dropping packets) but it would be nice to make sure pooling works properly even with reliable messages.
I've also noticed that Lidgren is causing GC Allocs despite pooling/recycling.
We're using Lidgren under Unity with message / storage pooling enabled. I would assume that this would cause Lidgren to re-use outgoing messages so that after a short time, there are no more allocations, but that doesn't appear to be the case. Some messages, at least, are getting recycled, but apparently not all of them, because over time GetStorage() continues to allocate new buffers and m_bytesAllocated grows larger and larger. If I put simple tracking inside GetStorage() and Recycle(), over time the number of GetStorage() calls exceed Recycle().
I've put a breakpoint where Recycle() checks for fragments, and that's not getting hit. Do you have any ideas for how we can reduce our memory allocations using Lidgren?