Search Unity

Discussion Ideas to find out what is causing this big spike in GC in editor

Discussion in 'Editor & General Support' started by unity_877B2C4C4EBA6FFD1E4D, Nov 26, 2022.

  1. unity_877B2C4C4EBA6FFD1E4D

    unity_877B2C4C4EBA6FFD1E4D

    Joined:
    Sep 2, 2022
    Posts:
    3
    Hey everyone,

    I'm trying to get some tips on how to get to the bottom of the following problem:

    Since some days I'm seeing my editor crawling to an absolute standstill performance wise after a seemingly random amount of time/actions.
    So far I have been unable to nail it down to any specific action, I think it happens mostly after leaving playmode. So as one does, I spinned up the profiler and started profiling the edit mode, this is what I am seeing:

    SCR-20221125-nm0.png
    As I dont remember doing anything differently in code compared to before I looked at the asset loading section, because it clearly tries to unload something. This is the result (same frame, though tbh. all frames look like this):
    SCR-20221125-nm7.png
    So yeah, that's not really helpful besides the fact that it seems to stem from
    UnloadUnusedAssets
    being called.

    I came up with the idea that this could be the following two methods:

    1.
     Resources.UnloadUnusedAssets() 

    2.
     EditorUtility.UnloadUnusedAssets() 


    I looked at where these are called in my project and set breakpoints, but none seem to be triggered or suspicious. Unfortunately, booth implementations of this are

    static extern void

    so I can't set any breakpoints to find out where they are being called from.

    So I know this isn't something broken on Unity's side (even though I wonder, even if there is stuff to unload, why does it seemingly not unload it and instead tries to do that every frame? I don' think it's something that is being loaded every frame, because I assume the allocation/loading of that would show in the profiler?), but I still cannot get to the bottom of it.

    Other things I have tried/done:
    - Set the Editor Throttling Mode to No Throttling -> No difference
    - Going back a reasonable amount of commits to try to nail it down to a specific commit -> No luck, it's pretty unreliable to reproduce in the first place and I am in a big team, making a ton of commit's, so it's a needle in a hay stack
    - Memory Profiler -> Doesn't seem to work with editor profiling?
    - Reinstalling Unity -> No difference
    - Reimporting project/deleting obj, tmp, Library folders -> No difference

    I am using 2021.3.14f1 (also happened with .12f1) and Rider 2022.2.4 for debugging/coding.

    Again, totally aware that this is most certainly something that I or any tool I use have broken, so I am looking for ideas and suggestions to help me get to the bottom of this.

    Thanks in advance!
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,449
    Hi,
    Are you on MacOS Ventura by any chance? Could be you're hitting an issue discussed on the thread this quote comes from.
    In other words, it wouldn't be an issue in your project but a general one.
     
  3. unity_877B2C4C4EBA6FFD1E4D

    unity_877B2C4C4EBA6FFD1E4D

    Joined:
    Sep 2, 2022
    Posts:
    3
    Hey MartinTilo!

    Yes, that sounds exactly like the problem I'm facing and I am indeed running Ventura! Thanks for taking the time to bring this to my attention, and even better to hear a fix is already in the works!
     
    MartinTilo likes this.