Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug The allocated memory increases over time (Mono)

Discussion in 'Profiler Previews' started by VGap, Aug 30, 2023.

  1. VGap

    VGap

    Joined:
    May 4, 2020
    Posts:
    3
    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.
     

    Attached Files:

  2. antonk-unity

    antonk-unity

    Unity Technologies

    Joined:
    Oct 4, 2016
    Posts:
    50
    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/Doc...rformance_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.