ITADN

Memory continuously increases on server during repeated client connect/disconnect cycles

#4089OpenLughsoft 创建于 2026-01-30
bug
L
Lughsoftcommented
### Description We are seeing **unbounded memory growth** on a Unity dedicated server using **Mirror Networking** when clients repeatedly **connect and disconnect**. The issue **does not happen if no players are connecting**. The server remains stable when idle. To reproduce, we created an automated **bot client** and a `.bat` script that continuously logs multiple clients in and out of the server. Under this scenario, memory usage **only increases and never goes down**. After ~24 hours of connect/disconnect cycles, memory reached **~7 GB**, causing the VPS to be killed by OOM. --- ### Environment * Unity: 2022.3.55.f1 * Mirror: 96.0.1 * Transport: KCP * Platform: Linux dedicated server --- ### Observed Behavior * Memory grows on every connect/disconnect cycle * Memory is not released after clients disconnect * Server idle (no connections) does **not** increase memory * Memory Profiler shows large growth in **Managed Objects → System.Byte[]** --- ### Expected Behavior Memory usage should stabilize or shrink after client disconnects, or there should be a supported way to cap or release internal buffer pools. --- Memory Profile Screenshot: <img width="1567" height="989" alt="Image" src="https://github.com/user-attachments/assets/d6f93715-276e-45c4-858f-ee1bd419d18a" /> <img width="1041" height="326" alt="Image" src="https://github.com/user-attachments/assets/8764bae0-0d04-47db-a259-06ea239fb1fd" />
4 条评论