Hi, @kirill.gaiduk.personal,
Welcome to the MongoDB Community Forums. I understand that you are observing a memory leak when using the 2.18, 2.22, and 2.23 versions of the .NET/C# Driver in a Unity project. You mentioned that the memory leakage rate appears to correlate with the heartbeat frequency with MultiServerCluster
instances only.
For Unity Development, we typically recommend our Atlas Device SDK for .NET rather than our .NET/C# Driver. The Driver is intended for server-side usage, not mobile clients or games. Unity is an officially supported platform for the Atlas Device SDKs, but not our drivers. That said, if you are observing a memory leak when using the .NET/C# Driver with Unity, we would be happy to investigate further. A few questions would help to get our investigation started.
- You mention that versions 2.18, 2.22, and 2.23 all exhibit this memory leak. Were these the only versions that you tested? Or do earlier versions not exhibit this leak?
- You mention that
MultiClusterServer
instances leak, but not others. To clarify, when the driver is connected to a replica set or sharded cluster, you observe the leak, but not when connected to a standalone instance. Correct?
- Do you observe the leak when connected to an Atlas Serverless instance?
- Do you observe the leak when compiling for JIT, AOT, or both?
- On which operating systems have you observed the leak?
It would be helpful to have a self-contained repro of the issue. Is anything more required than creating a new Unity project and referencing the .NET/C# Driver?
Thanks in advance for your collaboration in investigating this problem.
Sincerely,
James