MirrorNetworking / MirrorNetworking/Mirror

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

Open
#4,089 6 comments 0 reactions 1 assignee View on GitHub

@miwarnec is already working on this.

Since Feb 2, 2026.

bug
Dominant language
C#
Stars
6.3k
Forks
870
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.