How to know the total amount of memory that a capture is taking?

I have taken a capture of my game from my smartphone with the memory profiler and I would like to know the total amount of bytes that this capture is taking on the device.

There are lots of numbers like total allocs, all managed/native objects, etc, but I don't know how to calculate the total amount of memory (in bytes, MBs, etc) or if this number is accessible somewhere. Is it possible?

Sorry in advance if this is a silly or straightforward question.

Totally not a silly question but a shortcoming of the memory Profiler package as it currently is, and also partially a problem with the current memory snapshot capture backend. The backend issue is, that we don't actually capture what the entire memory usage of the app is. Some platforms attribute memory usage to different apps different than others (and use that info to decides what gets kicked out of memory). Also, Unity doesn't necessarily know about all memory Allocated by the App, in part due to native plugin memory not being tracked.

The UI should sum up everything it does knows about though and we'll add that.

The closest you can currently get to that is to sum up the sizes in Table > Alloc >ByMemRegion or ByRoot. That will get you the closest to what the OS sees but Unity allocates memory in buffers that might be empty so it's not a great way to see if you optimizes the memory usage because you might be using less Memory in these buffers but their size will remain that big until you reduced it even further.

We're working towards better memory reporting from the OS, getting you an overview number in terms of Used vs Reserved (similar to the Memory Profiler Module in the ProfilerWindow) and summing these things up so you don't have to. But we're currently addressing even more fundamental issues of the code base to make sure we can make these and similar UI changes efficiently. That means we're currently a bit slow at improving the UX and UI but should be able to really double down on them soon and with a good cadence.

So for now, the best workaround is to get an overview from the ProfilerWindow and do the deep dive in the Memory Profiler package.

Great! Thanks for the detailed answer. It's understandable. I find this tool really useful and I'm glad that you're working on it to improve it.

1 Like

Thank you for the detailed answer. Would be really cool to see Total parameters in the Memory Profiler package. It is a good instrument for looking up specific problems with specific objects, but not really helping to find out how much memory our game is using on the specific device.

1 Like