Search Unity

Analyze no longer works at all, hangs after allocating over 28GB of RAM

Discussion in 'Addressables' started by RecursiveFrog, Jul 15, 2019.

  1. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    173
    Unity 2018.4.3f1
    Addressables 1.1.4-preview

    It's been a while since I've run the Analyze function in Addressables, and so I decided to run it again on my project. I selected "Fixable" problems only.

    After building and the project and beginning the analysis, I'm sitting here currently with Unity Editor allocating 30GB of RAM. The editor has hung, and it is completely unresponsive. The allocation has stopped at 29412.7MB, but the application has completely stopped responding. This has happened 3 times, even after restarting the computer.

    Is it expected behavior that the more assets you want to use the longer this analysis takes the more memory it requires? Is the issue that some of my assets depend on imported packages since I am using UPM for things like code libraries and shaders?

    One other possible cause is that in all my asset groups I have chosen "Pack Separately" in hopes to keep every bundle as small as possible. Is *this* a cause of the issue?
     
  2. Greyborn

    Greyborn

    Joined:
    May 26, 2016
    Posts:
    33
    If it helps for reference, we recently did a test on our own project and we ended up having hundreds of individual assets and scenes added and also were choosing Pack Separately and we did not see this issue (2018.4.1 / 1.1.4)
     
  3. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    173
    Interesting. @Greyborn , do you use any of the following?

    -Prefab Variants
    -Unity Package Manager (for your own code)
    -Unity Package Manager (for asset store assets or shaders)
    -Animator controller Overrides

    I would say that there are probably about 100 items being packed separately in this project, with many of them being prefab variants that have models in the project m. Directly, but shaders that live in an external Unity package linked with UPM
     
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    313
    Have you tried downgrade to 1.1.3 or 0.8.6 to see whether that's a recent added issue.
     
  5. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    954
    100 items, and 30GB of ram. are the items HUGE? It's possible we're loading them into memory when we shouldn't, but to turn 100 items into that much memory usage, I'd imagine we'd have to invent our own memory.

    I'd guess it's specific to prefab variants. Perhaps somehow we wind up in an infinite loop of variant generation. If you have a repro project and can open a bug against Unity with it, that'd be a huge help.

    -Bill
     
  6. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    173
    No one thing should be huge. I would be shocked if the assets in question totaled that many.

    Couple other things occurred to me:

    1. Does the Resources folder(s) end up being part of this analysis? SLATE, TextMeshPro, and PixelCrushers' dialogue system end up adding things to Resources. There actually are quite a lot of things in various plugins' resources folders that aren't being used currently, and that I haven't yet pruned.

    2. Should Editor/Resources folders end up in the analysis? SLATE's resources are actually explicitly for the Editor but they appear in the list of assets

    3. A repro project might be tough to make since I can't say exactly when this happened or what could cause it. I'll see if I can get one for you though.
     
  7. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    173
    @unity_bill Deleting all my scenes from Addressables resolved this issue. The analysis completed.

    So I looked back and there are two scenes with asset store art in them. Those two scenes count for 10GB of the allocated ram... however even getting rid of those two doesn't prevent the hang. Unity is still stalled out. The other scenes are mostly minimal.

    Ideally it would be great if Addressables could analyze lots of scenes each of which might be heavy, as the game is divided up into dozens of them.

    By the way, I understand how large an undertaking this tool is. Thank you and your team for all their hard work.
     
  8. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    954
    Yes, it definitely should.

    Can you run Build Player Content without problem? If that does run, and analyze doesn't, something very weird is going on. What about the various play modes (fast/virtual/packed)?

    Thanks for your feedback
     
  9. RecursiveFrog

    RecursiveFrog

    Joined:
    Mar 7, 2011
    Posts:
    173
    All the play modes work for me, and I am able to build player content. The process takes about 10 minutes. Building the content does not allocate large amounts of memory the way analyze does.

    My test cases are based around the assumption that the assets are stored locally, not on a remote server.

    Addressables works at runtime as expected both in the editor and also in a PC stand-alone build.


    I did find that the hang finally stopped on this smaller 20GB instance. It took about a half hour to complete the analysis The machine is a VR capable rig with top of the line components that were available 3 years ago and 64gb ram, so I dread to think what this process would do to a more modest machine. :)

    Perhaps some sort of progress indicator, combined with moving the process off the UI thread, would help matters. Having the entire Unity app unresponsive for a half hour is rough.
     
  10. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    954
    Agreed. something weird is going on there, we'll look into it.