Search Unity

Question Unable to profile project due to lack of memory

Discussion in 'Editor & General Support' started by Riftskipper, Oct 26, 2022.

  1. Riftskipper

    Riftskipper

    Joined:
    Dec 5, 2020
    Posts:
    3
    I have to work on an older project (using Unity 2018.3), which in turn was built on top of another even older project. I suspect it has some bad memory leaks because the memory usage shoots from 6GB to 12GB in under a minute after loading from the main menu to the game scene, then constantly freezes every few seconds. My guess is the freezing is due to garbage collection.

    Because it uses all the memory (my work computer only has 16GB RAM), I cannot run the editor profiler without the editor crashing, so I cannot determine what is leaking, or even confirm whether the problem is memory leaks. The standalone profiler crashes too.

    The memory profiler package also doesn't work, it crashes when I try to profile the build, and when I try to run the scene in editor it takes 30 min to take the snapshot, and then is unable to open the snapshot due to OverflowError. It doesn't help that the only version I have available is 0.1.0-preview.9, since a similar OverflowError bug was fixed in 0.2.6.

    Anyone know of any workarounds or solutions that would let me profile this project somehow? Or is my best bet to just dig through every single script and hope I can find the leaks? I do not have internet access at my workstation, which probably limits my options somewhat.
     
    Last edited: Oct 26, 2022
  2. GrahamHuws

    GrahamHuws

    Unity Technologies

    Joined:
    Mar 14, 2022
    Posts:
    20
    Hi @Riftskipper! I don't have any amazing ideas to suggest I'm afraid - 2019 should be much better for profiling if you're at all able to upgrade further, but perhaps not if you're without internet there. Does the freezing occur with standalone builds of the game, only in the Editor, or both?
     
  3. Riftskipper

    Riftskipper

    Joined:
    Dec 5, 2020
    Posts:
    3
    Thanks for replying!

    I could try asking if we can upgrade to 2019, but it seems unlikely to happen.

    The freezing occurs in both editor and standalone.

    I think I have confirmed that garbage collection is what was causing the freezes, and that memory leaks are the problem. I turned off automatic GC and the game then ran without freezes until it crashed with a bunch of "System out of memory" exceptions after a few minutes.
     
  4. Riftskipper

    Riftskipper

    Joined:
    Dec 5, 2020
    Posts:
    3
    It turns out that the 2019.4 profiler does not crash when I run it and the build at the same time, so I was able to profile the app successfully.
     
    GrahamHuws and MartinTilo like this.