1. We've introduced thread tags, search within a thread and similar thread search. Read more here.
    Dismiss Notice
  2. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice
  3. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  4. We've released our first Timeline Experimental Preview, our new tool for creating cutscenes and more! To check it out click here.
    Dismiss Notice
  5. Unity 5.5 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  7. Unity 5.6 beta is now available for download.
    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:
    441
    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:
    441
    OK i have found a solution. I can get to the details through the profiler providing i do a development build.

    Profiler.usedHeapSize