The allocated memory increases over time (Mono)

Hi all,

the mono build has an unclear memory allocation happening over time. According to profiler project csripts allocate 0 bytes, but memory keeps growing over 100 Mb in 1 hour. If the application runs for 100 hours, the memory allocation can grow to 10 GB.

Unity 2022.3.7f + Memory Profiler 1.1.0-pre.1

Below are the memory snapshots in comparison.

Have you had to deal with similar issues?
What direction do you need to look deeper into?

Thank you in advance.


Hi. I can’t say much about the source of the leak, but the fact that it’s “unknown” is a bug.
It happens if someone (inside Unity) isn’t using memory “labeling” functionality.

If you have a repo project, please report it as a bug.
If you want to investigate it yourself, you’ll need to use platform memory profiling tools. In that case, you must turn off Unity Memory Manager (see command line “-systemallocator”) and profile & compare using that tool.
If you’re on Windows, you can try https://docs.unity3d.com/2018.3/Documentation/uploads/ExpertGuides/Analyzing_your_game_performance_using_Event_Tracing_for_Windows.pdf

As an alternative, you can try and upgrade to 2023.2 alpha, and check there. We might have fixed it already and you’ll see the culprit. However, it isn’t always an option, as upgrading a large project might be a long and tedious task.