I am trying to investigate why my VR app is crashing due to memory leaks. I think that there’s a bug in the code that is not Destroying Texture2Ds that are created at runtime. I took 2 snapshots: B is the snapshot from when the game level is on (so Texture2D count is expected to be high) and A is the snapshot from the game lobby (so Texture2D count is expected to be low).
When I compare the snapshots, I see that there’s a 300mb difference in Total Resident On Device, but I cannot see what is taking up 300mb of space in the other snapshot.
Question: why is there a 300mb difference in Total Resident on Device, but the differences in Allocated Memory Distribution are not 300mb in total?
Because the bottom table is only showing comparison stats on the Allocated amounts, not the Resident amounts, which also can not be fully attributed to all categories (e.g. Graphics memory is not tracked with knowledge of the address at which the Graphics Driver allocated the RAM backing memory for its buffers, and without that, the per-page Resident Memory info can not be attributed to each resource).
You can hover the bars to see for the categories where it can attribute the residency information, how those are split. The Comparison tables sadly only support Allocated comparison modes ATM so you would have to open these two snapshots in single snapshot mode side by side to visually diff the All Of Memory table in Resident mode to spot the difference.
Chances are though you just started using some otherwise previously reserved and non-resident amounts, making them resident by “touching” them, from the OS’s perspective.