Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

making sense of the memory manager

Discussion in 'Editor & General Support' started by sgower, Sep 3, 2016.

  1. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hello, While building my (PC) game, I really haven't spent any time attempting to optimizing things regarding memory usage, so it's definitely time I take a look at this. The game is a (Vive) VR game, so it will be running on higher end systems. The minimum ram specs for Vive are 4GB of ram, although I suspect that most users will have 8 or 16. But assuming a user has only 4, my first question is how to determine what a reasonable memory usage should be for a unity game running on such a system?

    When I first profiled my game, I saw a significant amount of memory was being used (4.77GB)


    But when I stopped and restarted, the Used Total dropped down to 2.21GB



    Can someone help me understand why the memory usage would drop in half? Which number represents the total that the game is actually using?
    Are there red-flags in the above numbers that I should be concerned about? The game itself is an environment builder game and so ideally I'd like to support a high number of different model types, and a large number of materials. I'm new to Unity game building, so I'm likely making some rookie mistakes, but I'd very much like to correct as many of these as possible before I get too much farther along in the development. Any advice you may have would be appreciated. thanks!
     
  2. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    The built game looks to be using only 463MB, so I guess that's not so bad.
     
  3. Kim-Riber

    Kim-Riber

    Unity Technologies

    Joined:
    Feb 25, 2011
    Posts:
    25
    Hi.
    In the Editor, memory usage can be vastly different from the usage in players, because of textures and meshes that are kept in memory, and editor resources being loaded.
    One thing I've noticed in your screenshots, is that Mono has reserved a very large block of memory. This is due to a very high peak memory usage during some operation (loading or player building).
    To get a view of how your game will perform of target hardware, connect the profiler to the game running on device, and look at these numbers
    -Kim
     
  4. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hi, thanks for the information. Yes the built game itself does seem to use much less memory. I actually haven't spend much time building and running my game. I had built the game awhile back, and the built version didn't run correctly and I just hadn't (until this week) gotten around to re-building the game and troubleshooting the issues. Based upon what I've seen, I shouldn't have any memory issues.