Memory profiling question: "Used Total" vs "Total System Memory Usage"

Hi @SullyTheStrange_1 ,

Thanks for the question! I’ll explain memory stats here.

Unity Editor and Players internally use pools for all memory allocations. E.g. when allocating 16 bytes we ask system to allocate 4MB (in the Player) or 16MB (in the Editor) block and then all subsequent allocations use that memory. If block is full, we allocate another one and if it’s empty we return it to the system. This technique is used to improve performance and reduce fragmentation.
And also this makes stats a bit confusing.

Used Total - memory used right now if we don’t take pools and allocation headers data into account. Essentially it is sum of all internally managed allocations which are not freed yet. Profiler.GetTotalAllocatedMemoryLong is the Scripting API getter.

Reserved Total - is how much we took from the system. This includes all allocated memory including pools and extra allocation headers. In our case it is commit memory - we allocate on heap (reserve+commit). Includes Used Total. Scripting API equivalent - Profiler.GetTotalReservedMemoryLong.

Total System Memory Usage - total size of used (commit) memory by Unity process. This includes everything what is used by the process - Reserved Total + executable’s images (code and data). It is PrivateUsage of PROCESS_MEMORY_COUNTERS_EX on Windows.

Taking this into account in your case I would say that if Reserved Total >1GB player might definitely run out of memory on end-goal device. If TSMU>1GB system might page some some memory to disk, but that’s not guaranteed and it might make performance horrible. So it is always safer to have TSMU<1GB.
I would say TSMU is what should be mentioned as Required Memory in System Requirements for your game.
(That’s assuming you have TSMU data from the player.)

12 Likes