The snapshot of memory usage has been taken directly from the app running on a test device (iPhone). The total allocated memory seems to be 502.7MB, which coincides with the memory usage reported in Xcode.
I used the Memory Profiler package and took snapshots to break down the memory usage within the Unity project. The total memory used in the Unity project is 176MB. I optimized shaders, cut down on the use of materials, and optimized texture import settings, which are the top 3 memory-consuming areas. However, it seems there is little I can do apart from what I’ve done already to reduce the total memory usage of the app while running.
While 176MB of memory usage might seem a lot already for low-end mobile devices, it’s not as crazy as the 262.3MB used by the Native memory footprint, for which I don’t have much control over.
The project is simple (although it contains quite a few graphics assets): it only contains a single scene, with some panels and a few sprites, using Unity UI. It uses the AdMob SDK, which I think contributes to the Native memory footprint when converting to native C/C++ code. Also, I communicate with devices’s cloud and game services and native UI (alert dialogs). There’s nothing else apart from this. I would like to know a breakdown of the Native memory distribution to see which libraries or processes are taking/using the most memory, but it doesn’t seem I have access to it.
I don’t know if somebody has experience something similar and could provide insights into things could be done to improve it.
Have you profiled a release build? Generally debug builds consume a lot more memory.
You could check how much AdMob uses by creating a new project and build once, then add Admob and build again and compare the memory usage. Just so you have an idea what portion of memory AdMob uses. There may be settings or usage recommendations for AdMob in their manual regarding optimizing memory usage.
This is an empty project in Unity 2D. Xcode (above) already gives it a High Energy Impact tag, with 169.1MB of memory usage. Of course, the ‘object stats’ are using less than 1MB, so there’s no much one can do (after all it’s an empty project).
The project only consists of a single game object, which is the default camera, and these packages.
190MB seems a lot to me. Also, there’s a difference of 70MB between the 260MB I was seeing on the other project and the 190MB of this empty project that I can’t seem to track.
Sorry, I forgot to reply. The data I’ve shown here is with a debug (Development Build + Autoconnect Profiler) because I wanted to be able to track down the memory usage.
However, I built the project with a release build before for testing in TestFlight and the memory usage was 475-480MB in Xcode, compared to the 500MB of the debug build, so there doesn’t seem to be much of a difference.