Skip to content

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

@Lughsoft

Description

@Lughsoft

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:

Image Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions