Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

GC Alloc: 3.6GB !! - CPU: 227205.42ms !! when enter play mode

Discussion in 'Addressables' started by LeonardoADS, Dec 19, 2018.

  1. LeonardoADS

    LeonardoADS

    Joined:
    Aug 10, 2014
    Posts:
    10
    This thread starts in:
    https://forum.unity.com/threads/enter-play-mode-40-458-337-instances-of-gc-alloc.600352/

    I don't know why Addressables Assets System (0.5.2) is slowing my editor so much...
    I can't save the stacktrace.data because its too heavy (I get the same error everytime "System Out Of Memory")

    Screenshot_6.png
    Screenshots of profiling the editor (Deep Profile):

    Screenshot_6.png

    This error starts suddenly and i don't know how and why, before addressable assets worked perfectly..
     
    Last edited: Dec 19, 2018
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    989
    Things clearly got out of hand there. Are you still using 2018.2 as you mention in that other thread?

    How many scenes do you have in your project? And how many are addressable and/or in the Build Settings window scenes list (disabled or not)?

    Thanks for reporting this,
    -Bill
     
  3. LeonardoADS

    LeonardoADS

    Joined:
    Aug 10, 2014
    Posts:
    10
    Actually i'm using Unity 2018.3.0f2

    Uhm... actually it was my mistake , i don't know how i have 169 scenes in build... usually i only have 3 scenes in build... Screenshot_4.png

    Now works perfectly, removing all the unused scenes and now everything is normal...

    Anyways, i only have a few addressables assets:

    upload_2018-12-19_15-19-53.png

    THANKS!!
     
    Last edited: Dec 19, 2018
  4. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    989
    thanks, that still probably means we're doing something wrong in our code that 169 scenes blew things up. Either way, thanks for your info.
     
    MNNoxMortem likes this.
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,458
    If it happens again please give a case number which will surely help narrow things down :)
     
    MNNoxMortem likes this.
  6. AlbertoMastretta

    AlbertoMastretta

    Joined:
    Jan 1, 2015
    Posts:
    63
    I seem to have encountered a similar issue. When I enter play mode it takes about a minute to start playing a simple scene with just 1 rotating cube, a light and a camera. I used the profiler and found out my GC.Alloc function is taking up a massive amount of memory. I haven't had this problem before, my scene is practically empty with just the rotating cube. I tried looking into the build settings and seems fine, just 2 scenes. I opened and closed the editor to try and reset things, but I still get the same result. I'm using 2018.3.2f1, and here is a screenshot of the profiler: e18f6869dc7529e9e6e687debe597aeb.png
     
    MNNoxMortem likes this.
  7. AlbertoMastretta

    AlbertoMastretta

    Joined:
    Jan 1, 2015
    Posts:
    63
    So after a full day of scouting for the problem, i found that if I delete a bunch of scenes my problem goes from a 3.6GB CG.Alloc to a 0.5GB. Those scenes all use terrains, so not sure if it has something to do with the new terrain system. Since it didn't end up being a problem with a script but instead with content, I believe there is some problem with the current version of the editor.
     
  8. AlbertoMastretta

    AlbertoMastretta

    Joined:
    Jan 1, 2015
    Posts:
    63
    Finally soved it. The culprit was Pro-Builder, I was on version 4.0.2. It has a call for versionvalidator.validateversion() that makes insane amounts of calls and string.build(). 5 MILLION Calls for strings within that method that were generating 0.5gb of GC.Alloc. I removed Pro-Builder and now my game starts very quickly. I believe this bug scales up with more 3D assets or scenes, given that removing scenes with lots of 3D objects brought down the problem form 3.6gb to 0.5gb.

    It was still a huge annoyance so I continued to investigate till I found that call. I couldn't find it before I brought down the GC.Alloc. I needed to use the deep profile mode and my computer would get stuck with that amount of info in the profiler. Hope this helps anyone who encounters this problem, and I hope the Pro-Builder team fixes it.
     
unityunity