I’m running into an issue that I know many others must have run into in the past. Quite simply, when I profile the game on device (iOS 8) with the Unity Profiler and with XCode, I get vastly different results. The most important numbers to me came from one test case, where we hit 200MB in the Unity Profiler and a whopping 320MB according to XCode. Our target for ship is 256MB, so you understand the predicament.
Looking around, I’ve seen some answers that can account for this, but I’m very much hoping someone can step in and say “I dealt with this, and here’s the cause” Possible explanations:
The Unity Profiler really just doesn’t account for all that much, and our app in actuality does require this much RAM. Please don’t be this.
XCode results vary in low-memory conditions VS memorytopias, i.e. at some layer of the app/engine/OS onion, we aren’t returning memory to the OS until it actually needs it. This would be a fine explanation, because it would mean that the XCode high-water-mark isn’t actually particularly meaningful.
XCode is simply wrong sometimes.
Appreciate the help. Once I find the explanation, whatever it is, I’ll be sure to update the thread.
P.S. Here are some related threads that all touch on the issue, though none of them have a satisfactory answer:
Well, it didn’t take long to run into a pile of sadness on this. On low-memory devices (where we have roughly 300MB) we do certainly crash in a dev build where the Unity Profiler is telling us we are only consuming 190MB. This more or less removes the two XCode bullets out of contention, and makes the problem real.
Could this really be true? Could we be sitting on an anonymous pile of 120MB, with no way to crack open its contents?
Next up I will be checking the following:
Is this also happening on Android?
Does the size of this overhead(?) fluctuate linearly w.r.t. the size of content or code or static data, or…?
Does releasing memory in Unity affect this number? For this I will probably make a test project that lets you load and unload a bunch of resources at will.
(Just wanted to add that even chiming in with ‘For us, there was never really a delta between actual memory usage and the Unity Profiler Reserved Total’ or ‘There always seemed to be a small, 10MB difference for me that I just ignored’ would still be very helpful. Any or all information is appreciated!)
hey leapfrog I haven’t ran into this mainly because I haven’t gotten to the stage you are at yet, but I’ve read several posts related to profiler and xcode variances.
If memory serves me - it seems the multiple sources of information I remember all stated the same thing you are experiencing. Again relying on memory here but I seem to remember several people stating the xcode readout is more accurate.
I don’t know if this has anything to do with pro vs free or not but it’d be interesting to know why the profiler doesn’t register accurate numbers - if this is really the case.
I hope you figure it out. Please keep posting your findings.