Closed doyouean closed 11 months ago
And here we are again. All considering, the frequency of OOM issues is actually surprisingly low. That Samsung M11 comes with 3 or 4GB of RAM, but we have no idea how much of that Unciv can actually use. Likely less than 512M.
We do set android:largeHeap="true"
- this was the first and for a long time the only influence an App had over its heap size, right? Introduced in Android 3 I believe. Did they add any more methods later??? No idea.
Could we try to display the actual heap size in a crash screen? No idea whether Java's Runtime.getRuntime().maxMemory() such as SystemUtils line 37 does for desktop has any meaning. I'll see later how to get [getMemoryClass()](https://developer.android.com/reference/android/app/ActivityManager#getMemoryClass()) into the crash screen info.
@doyouean - this means more or less your map is too big, or you are using an "expensive" (in terms of memory) graphics mod via "permanent audiovisual". This paragraph on Android's developer documentation basically confirms - we don't have control, your device limits us.
Wait - "permanent audiovisual" - we should include that in our crash screen info too.
We've done all we can here - memory limits will be hit by players with huge maps on Android, and we do warn against it, but this is better than artificially limiting sizes for those players who can effectively run gigantic maps.
And I learned something - even on my 8GB Mi10T, Unciv only gets 512MB for its heap. Am Surprised.
Platform: Android Version: 4.8.15 (Build 925) Rulesets: [LOTR Unciv, Civ V - Vanilla, Brave New World, Civ V - Gods & Kings, DeCiv Redux, Community Maps, Civ6 mod, 5Hex Tileset, Alpha Frontier] Last Screen:
com.unciv.ui.screens.savescreens.SaveGameScreen
Device Model: SM-M115F API Level: 31
Message:
Save Mods:
Save Data:
Show Saved Game
``` No save data: java.lang.OutOfMemoryError: Failed to allocate a 9443680 byte allocation with 3599504 free bytes and 3515KB until OOM, target footprint 268435456, growth limit 268435456 ```