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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

How Can I Find Out How Much Memory Unity Is Using?

Discussion in 'Scripting' started by karljj1, Apr 2, 2012.

  1. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    Hi,

    I want to determine how much memory Unity is using at runtime so i know if it is safe to load in more data or stop and wait for memory to become free. This needs to be an automated process so i cant use the profiler.

    I have tried Process.GetCurrentProcess().PrivateMemorySize64 but it is allways 0. It seems mono does not support this.
    I even tried building a .Net DLL to do the query but i still get 0.

    Does anyone know a way around this?

    Thanks

    Karl
     
  2. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    OK i have found a solution. I can get to the details through the profiler providing i do a development build.

    Profiler.usedHeapSize