Total memory usage

Is there any way to query the total RAM usage of the standalone player? All Unity functions seem to report only the sandboxed mono part of memory usage. And System.Diagnostics.Process.workingSet64 returns zero inside Unity.

1 Like

Having the same problem. Would love to know how to do this. No one seems to know for some reason. And it seems like a really common thing you would want to know – how much total RAM is my application using on the system.

Are you talking about how much RAM is your game using? There are hundreds of different ways of measuring that.

You can use Unity’s profiler, you can use RivaTuner, etc, etc, etc. Even the task manager lol

Yes, but the issue is getting a real “hard number” of total memory being used, from code, while not using the profiler.

You can’t use the profiler functions during a real game build, as the profiler is not attached. And my use-case is for getting the total RAM my game is using during a standard game build in order to use it as a condition in my code (i.e. during the game while the player is playing). That is, if during the game the memory goes above 1.4 GB, then do “xxxxx” (in code).

So it’s not as easy as you are suggesting. I have yet to see a simple Unity function that returns the total amount of memory your game is using during runtime – during a play session apart from the Editor/profiler.

I don’t understand what are you talking about.

You CAN use the profiler while playing a build, i do it all the time.
As i said, every single one of my examples clearly specifies the exact ammount of RAM your game is using.

Now about coding, that’s kinda… uncommon. I never tried to do something like this, but i am pretty sure this wouldn’t be a good thing to do, as you would have to somehow gain access to the user’s PC, and hack into the system to get the ammount of RAM X application is using separately from every single other task. Not to mention the difficulty of doing this, as memory types and specifications can vary. Also, if the user has an antivirus, it will surely detect this as some kind of malicious action and crash/block your game, and it can ALSO cause performance issues.

Come one this dosnt seems to be an answear, but i understand what he say, im looking the same thing , coz i need the game load some assets bundles and unload from memory but avoid a certain limit and if the game its taking too much assets bundles in memory then for dinamically stop load them till some fresh space on memory would be for keep adding and removing objects from memory… i need to know this for set a limit too! :L