WP8 Profiler Memory Discrepancy

Hey,

I’ve attached an image showing memory usage as reported via profiling WP8 devices for the app I’m creating with Unity 4.5.1f3. Via the attatched image, SC01 and blank scene are ran on a 512MB device (memory limit of 180MB), SC02 on a 2GB device (memory limit of 570MB).

The problem I’m running into is that the app crashes on 512MB devices via a Application.LoadLevel call from SC01 to SC02, which is because the “Total System Memory Usage” is above 180MB. But there seems to be a chunk of invisible memory being used (at least according to what Unity can see) as the “Used Total” is sitting at a vastly different amount than what the “Total System Memory Usage” and “Commited Total” are reporting.

That invisible difference in SC01 is ~50MB but in SC02, its over 120MB! I am unsure as to what this invisible memory is represented by (.NET related? / XAML related?) but its clearly a significant amount that Unity doesn’t have profiling info on.

I’ve tried inserting a blank scene in between the two scenes in case it was some how a spike from both of them being in memory at the same time, but that lead to me seeing that a blank scene showed a “Used Total” of ~15MB but a “Total System Memory Usage” of ~45MB (literally created a brand new project and profiled a blank scene on a WP8 device).

While the app is already decently optimized in regards to assets (DTX1 compression where it can be used otherwise DTX5, reduced texture sizes, compressed audio, etc) I have to manually reduce the assets down by ~30MB in SC02 (reducing some textures down to ~8KB from ~2MB, etc) before it stops crashing on transition from SC01. Much less than what would seem to be needed via the SC02 “Total System Memory Usage” which would lead me to believe I would need over 60MB reduced.

Does anybody have any insight into why there is this huge discrepancy between “Used Total” and “Total System Memory Usage” and what it actually represents? Maybe I am just missing something obvious but I would expect a “Used Total” of ~125MB to run fine with a memory cap of 180MB.

I found a post in which the same discrepancy can be scene in the profiler: [Tips and Tricks : Make sure to profile your phone app's memory usage! - Unity Engine - Unity Discussions] but unfortunately that post doesn’t talk about anything relating to it.

Hi,

that invisible memory is something that Unity does not have control over - CLR (including all managed objects), XAML as well as other OS stuff. Without further investigation, I can’t tell what’s eating up the memory exactly.