Search Unity

Curious about memory size from System.GC.GetTotalMemory(false) and Window`s task manager.

Discussion in 'Scripting' started by Lagnas, Sep 1, 2015.

  1. Lagnas

    Lagnas

    Joined:
    Apr 27, 2014
    Posts:
    18
    Why memory size that Window 7`s task manager showing, differ from size that System.GC.GetTotalMemory(false)?

    My project in unity have 3G byte memory from task manager showing. But System.GC.GetTotalMemory(false) show different size, only 250M byte.

    Why differ from two size?

    GC.GetTotalMemory(false)`s size is same as benarchy profiler asset. But not window 7`s task manager.
     
  2. Will-H

    Will-H

    Joined:
    Dec 12, 2013
    Posts:
    8
    I think that GC.GetTotalMemory will only report the bytes allocated by the scripting engine of Unity.
    It does not account for the memory used by the engine itself in native code outside of the scripts.

    If you are running inside the editor, then the memory allocated by the engine will be even greater (for all the windows, views, inspector, profiler etc ...)
     
    Kiwasi likes this.
  3. Lagnas

    Lagnas

    Joined:
    Apr 27, 2014
    Posts:
    18
    Thanks!! My curiosity is solved!