Hello,
I’m trying to get the memory usage down of our game on Android devices, as on “low” memory devices (2GB and below), the game gets killed if the game shells out to a link in the browser.
The first step is obviously trying to understand what exactly is using the memory.
Our game is built with Unity version 2019.4.18, but for getting the memory profiler to work better, I’ve updated to 2019.4.31 for the purpose of making builds for profiling. Builds have been built in development mode, but in release mode in Android Studio. The device being tested on has 4GB ram to make there’s enough space to not get influenced by memory pressure.
Using the memory profiler package, on one specific point, I am seeing 314MB in use and 412MB reserved. However using adb command adb shell dumpsys meminfo, it is showing memory usage is 772MB. That’s quite a massive gap and I would like to understand why that is, or if I am misunderstanding something. Screenshots of both are at the bottom of this post.
As far as I can tell, it looks like the “Private Other”/“Unknown” category of the adb command might not be tracked by the Unity memory profiler, but there’s no easy way to determine what’s in there. (The value remains high on non development builds as well). I checked a competitor game that according to logs looks like it’s built with a similar 2019.4 version, and their “Private Other” is much much lower. So it looks like it should be possible to get that lowered, but we might have third party libraries or code that’s creating buffers that aren’t properly released to the system or something like that. I am not an expert in native Android development and debugging, so maybe I’m missing something obvious.
I would appreciate any advise on tools, techniques, or knowledge on finding out what’s up with the memory use, and then thinking about how to reduce it.
Thanks!
Screenshots
Unity memory profiler:
adb memory usage: