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
  4. Dismiss Notice

Editor Memory Leak related to GI Cache trim disk job

Discussion in 'Editor & General Support' started by forzabo, May 24, 2020.

  1. forzabo

    forzabo

    Joined:
    Aug 28, 2015
    Posts:
    60
    Posting this in the hope that this helps preserve someone else's hair...

    TLDR; Massive Editor memory leak after doing some light map baking? Try clearing the GI Cache (Preferences -> GI Cache -> Clean Cache)

    Long Story Version:

    I ran into a confounding memory leak in the Editor in my project where Unity would gobble up about 4MB a second until of course I quit or it consumed all of my system's memory. Very frustrating. Working with the memory profiler didn't suss out anything I could make sense of.

    Problem started in 2019.3; I upgraded to project to 2019.4 and it persisted. Cleared Library, reloaded project problem persisted. Rolled project back in VC many steps to where I was certain it hadn't been leaking before -- problem persists. Weirdly though, running the same project on my MBP resulted in no memory leak. All along I had a hunch that the problem had something to do with Lightmapping, as that when it seemed to start; in fact I had a similar memory leak earlier after doing a bake on a large scene and leaving my machine unattended but in that case after fumbling around I managed to make it go away.

    Finally the bright idea dawned on me to see what was happening in the console -- clearly some process was going rogue. Sure enough: this message was being printed over and over:


    TrimDiskCacheJob: Current cache size 11575mb
    LocalFileCache size was not reduced below threshold at path: /Users/bo/Library/Caches/com.unity3d.UnityEditor/GiCache. ( 12137520064 / 10737418240)


    Googling around on TrimDiskCacheJob tells me it has something to do with the GI Cache. Aha! I hit "Clean Cache" and the leak stops. Happy Dance.
     
    dmenefee likes this.
  2. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Thank you for confirming this! The same thing happened to me. I'd say this is a bug worth filing...
     
    MartinTilo likes this.
  3. ben-spencer

    ben-spencer

    Unity Technologies

    Joined:
    Dec 2, 2019
    Posts:
    7
    Yes, please file a bug report by following the instructions here: https://unity3d.com/unity/qa/bug-reporting. Having detailed log and core dump data will make it much easier for us to narrow down the problem, even if isn't necessarily easy to reproduce.

    If you happen to uncover new or more specific information on what you think could be causing the issue, give us a nudge and we'll factor it into the report.
     
    MartinTilo likes this.