RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.07k stars 496 forks source link

GC too much #119

Closed TraditoreZ closed 6 years ago

TraditoreZ commented 6 years ago

I have a problem at the moment when a number of transmission operations in the same frame will produce a large number of GC, and how can this be solved? void Update() { if (this.peer != null) { for (int i = 0; i < 1000; i++) { this.peer.Send(b, SendOptions.ReliableOrdered); } } netManager.PollEvents(); } like this. 1

TraditoreZ commented 6 years ago

My server will now eat all the memory in a few minutes . How to do it, please!

RevenantX commented 6 years ago

@TraditoreZ this happens every frame?

TraditoreZ commented 6 years ago

every frame . on the contrary, I don't think the reliableordered agreement is in time to go back to the NetPacketPool

TraditoreZ commented 6 years ago

When a reliable transmission reaches a certain magnitude, you can easily reclaim the problem.

RevenantX commented 6 years ago

i found mistake. Get latest version. This bug must be fixed. https://github.com/RevenantX/LiteNetLib/commit/dfd2d27e6f2cf91f7336b3953add33de4d78fd7c