Search Unity

Profiler: 2GB meshes memory usage for little 2D game?

Discussion in 'Editor & General Support' started by zapposh, Aug 30, 2017.

  1. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    117
    Basically, I have a simple 2D platformer with not too much going on.
    What sticks out like a sore thumb in the profiler is the Meshes Memory usage.
    It starts around 1,6GB and can climb to 2GB during the level, in every level.

    Looking at the detail, the culprits seem to be "Shared UI Mesh" elements.
    All there is in the UI are some hearts for lives and a coin counter.

    Is this to be expected for this type of project? (screenshots attached)
    Just making sure...
     

    Attached Files:

  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Profile your exported game.
    To quote a little sentence from your second screenshot:
    "Memory usage in the editor is not as it would be in a player"
    The editor has all the stuff that you have in your project mostly loaded even if the scene does not contain it.
    In the exported game the memory usage should be a lot lower.
     
  3. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    117
    Still a little concerned tough, since if I delete the little UI hierarchy from the scene, the Meshes Memory goes down from 2GB to almost 0 (300KB).

    But I'll try not to worry about it. :)
     
  4. Zenix

    Zenix

    Joined:
    Nov 9, 2009
    Posts:
    213
    Which version of Unity are you using? 2017 has a pretty serious memory leak that was fixed in patch 2.
     
  5. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    117
    Interesting. I'm on 2017.1 p1, so I'll try updating.

    Also, after searching, I found that some users, in older versions of Unity, had major performance issues if their canvas was just a child of a gameobject, or a child of a gameobject not at (0,0,0), or if the parent was animated.

    While my parent was reset and not animated, moving the canvas directly to the root of the scene reduces the Meshes Memory from 2GB to around 50MB!