Search Unity

Unity UI Massive memory wastage in UI

Discussion in 'UGUI & TextMesh Pro' started by Wahooney, Aug 14, 2017.

  1. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    Hi,

    It seems that the UI has a massive memory footprint, I have a UI that's fairly complex (200-300 UI elements), but the Shared UI Meshes use up ~70MB on mobile, that's 25MB, 4x 11MB and 10MB shared meshes.

    When profiling in the editor I've had a shared mesh use up 16MB on a single quad?!?

    How can we reduce this value? 70MB for Shared UI meshes is absolutely ludicrous, especially on mobile where our entire texture load is ~60MB.

    Are these predefined Shared UI Mesh sizes?
    If so, why are they so big?
    How do I reduce that number to what it should be, ie. ~5MB by my cocktail napkin maths?

    I've tried reducing this amount by adding more Canvases, but that's had minimal results so far.

    Thanks!
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Perhaps it's the memory leak in "Shared UI" mesh that you see.

    Unity 2017.1.0f3 has a memory leak in the "Shared UI" mesh, see here. The memory leak has been fixed in Unity 2017.2.0b7 (player fixed, editor still affected). I expect Unity is going to back-port this bug-fix to 2017.1 eventually.
     
  3. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    Thanks, Peter77! I'll see if we can convert the project to 2017.2 ( or try bribing Unity into backporting that fix sooner :p )
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    At the time of writing, Unity 2017.2.0b7 has too many issues to be considered an option for production in my point of view.

    I'd wait a week or two for a 2017.1 patch release that addresses the memory leak instead. If you just want to give 2017.2 a try to see if it fixes the issue, that would certainly an option too. But don't expect the beta to work as stable, beside the memory issue, as 2017.1!

    Additionally, keep in mind Unity does not support backwards compatibility, so if you open your project in 2017.2, you might not be able to use it in 2017.1 anymore. Thus make a backup of your project first :)