Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug UIToolkit consuming huge ammounts of Ram (Possible Memory Leak)

Discussion in 'UI Toolkit' started by Leucaruth, Jun 10, 2022.

  1. Leucaruth

    Leucaruth

    Joined:
    Mar 7, 2014
    Posts:
    7
    I created a new project in 2021.3.4f1 LTS and used the UIToolkit to test it and learn how it works. After a while I noticed the PC was going slow so I opened the task manager and noticed that Unity was consuming almost 2gb of Ram, when usually consumes about about 500MB in an empty project.

    I restarted Unity and noticed that it was working correctly, with a normal ammount of Ram consumed, until I opened the UI Builder again. After a while it began to eat resources to reach more than 2gb of ram again.

    I tried to create another project and it was the same. I don't really think that its a normal behaviour that the UI Builder consumes about 1,5GB of ram, even more with only a label and a button on it, with nothing else.
     

    Attached Files:

  2. Leucaruth

    Leucaruth

    Joined:
    Mar 7, 2014
    Posts:
    7
    Replicating it is easy. Just doing a simple stress testing moving around one of the components makes the ram consumption build up infinitely. I uploaded a vid.
     
  3. Spectragate

    Spectragate

    Joined:
    Jan 23, 2022
    Posts:
    37
    Tested it on my PC with the same action (wiggling a button around) and my memory started increasing constantly as well (and didn't release the memory back after any length of time). I started at 1GB memory usage and got to 1.5GB after wiggling the button around for maybe 30 seconds. Only way to clear it seems to be to close Unity.

    I wonder if it's adding to the Undo history every tick whenever anything in the scene has changed, regardless of whether the action has 'completed' (like waiting for a mouse up)? This also seems to apply to actions like moving the opacity slider back and forward between 0 and 100.
     
  4. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    384
    Memory should be recollected by the garbage collector at some point. Can you file a bug using Help->Report a bug?

    Thank you for reporting this issue!
     
  5. Leucaruth

    Leucaruth

    Joined:
    Mar 7, 2014
    Posts:
    7
    Thanks I'll do it right away.

    It was a pleasure :)