Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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!