Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Silent crash on low spec device - how do debug further?

Discussion in 'Android' started by jerome-lacoste, Nov 16, 2016.

  1. jerome-lacoste

    jerome-lacoste

    Joined:
    Jan 7, 2012
    Posts:
    206
    Hello,

    Our app dies on a "low specs" device (iRulu X9), a device running Android 4.4.2 with 1G of RAM. The app works fine on other devices with 1G of RAM (although running Android >= 5).

    After spending a good part of the day on it, I suspect the problem is related to memory. But I find no exact explanation.

    Here are some details:

    The crash is silent. No special stack or signal written in the logcat. It crashes consistently during the load of the main scene of the game, albeit at different positions depending on what I try.

    Code (CSharp):
    1. I/Unity   (27261): ****  MonoHeapSize: 2240512 MonoUsedSize: 1327104 TotalAllocatedMemory: 145739845 TotalReservedMemory: 149218619 TotalUnusedReservedMemory: 3478774 usedHeapSize: 145739845
    2. I/Unity   (27261): UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    3. I/Unity   (27261): UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    4. I/Unity   (27261): UnityEngine.Logger:Log(LogType, Object)
    5. I/Unity   (27261): UnityEngine.Debug:Log(Object)
    6. I/Unity   (27261): WWTK.Util.TroubleshootUtil:DumpMemoryInfo(String) (at.....)
    7. I/Unity   (27261):
    8. I/wpa_supplicant(19117): [CTRL_IFACE]wlan0: SIGNAL_POLL
    9. D/Unity   (27261): Setting up 1 worker threads for Enlighten.
    10. D/Unity   (27261):   Thread -> id: 6cafa040 -> priority: 1
    11. I/ActivityManager(  488): Process com.google.android.gms.persistent (pid 26674) has died.
    12. I/ActivityManager(  488): Process com.google.android.gms (pid 26717) has died.
    13. I/ActivityManager(  488): Process com.google.process.gapps (pid 26689) has died.
    14. I/wpa_supplicant(19117): [CTRL_IFACE]wlan0: SIGNAL_POLL
    15. D/Unity   (27261): Unloading 25 Unused Serialized files (Serialized files now loaded: 0)
    16. I/ActivityManager(  488): Process com.Company.App (pid 27261) has died.
    17. W/ActivityManager(  488): Force removing ActivityRecord{42394c28 u0 com.Company.App/com.unity3d.player.UnityPlayerNativeActivity t83}: app died, no saved state
    18. W/InputDispatcher(  488): channel '42f645f0 com.Company.App/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
    19. E/InputDispatcher(  488): channel '42f645f0 com.Company.App/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    20. W/MediaFocusControl(  488):   AudioFocus   audio focus client died
    The fact that other apps die makes me think that the device has a memory issue and starts killing apps.

    I am not sure if it is possible to enable more verbose logging for Unity ? I tried adb logcat 'Unity:V'. No use.

    The code loads several components into the scene, by adding them additively. Those components load several textures. We use Sprite Packers.

    I saw that one atlas was rather large in the uncompressed set of textures:

    Code (csharp):
    1. 28.0 mb   12.5% Built-in Texture2D: SpriteAtlasTexture-House (Group 1)-2048x2048-fmt4
    I've tried changing out texture settings, creating several atlasses and grouping textures differently. Now the largest uncompressed texture is 12mb. It doesn't help. It even crashes earlier. I don't see big differences in the profiling information I dump when inside the editor.

    I've experimented with lots of things: disabling static batching, forcing openGL 2.0, using Quarter Res Textures (but as we don't have mip maps enabled, it doesn't help), go from Async to Sync loading, use NativeAndroid integration in AndroidManifest.xml and more. I searched for leaks but find no obvious candidates.

    Any idea on how to find more information about this crash?
    How can I validate my assumption that the problem is memory related?
    Has anyone had weird issues with Sprite Packing on lower spec devices?


    Note: we use Unity 5.3.6f1. I saw no specific issue mentioned in the 5.3.x later release/patch release, but will try them anyway. In the mean time, any help appreciated.
     
  2. DalerHakimov

    DalerHakimov

    Joined:
    Mar 14, 2014
    Posts:
    302
    I saw u r using 2048x2048 atlas for your texture.. Try to have multiple 1024x1024 atlas, set compression to compressed,ETC (not true color, or any other kind of settings). Keep forcing OpengGL ES 2.0 because Mali 400 GPu does support only opengl es 2.0 (iRulu X9 gpu is Mali-400). See if helps.
     
  3. JonPQ

    JonPQ

    Joined:
    Aug 10, 2016
    Posts:
    120
    Assuming your game has 3d textures or uses mip maps....
    Try this in your main code startup... (as early as possible)

    QualitySettings.masterTextureLimit = 1; //use mip 1 or 2 = half size textures to reduce memory use (also loads faster strangely)

    if you set this to 0, your game will use full size textures.. 1 = half size 2= 1/2 size
    Its a quick way to change no code, but have much smaller memory footprint.
     
  4. jerome-lacoste

    jerome-lacoste

    Joined:
    Jan 7, 2012
    Posts:
    206
    Update: we moved everything to 1024x1024 atlases, adjusted a few max texture sizes and compressed formats and the game now works fine. Using mip maps wasn't possible due to the game configuration.

    The game still doesn't work on the Urulu x9, which has a very low amount of RAM, but works fine on a Samsung Galaxy Tab 2 or kinde Fire (5th generation). It previously didn't on any of those.

    Thanks to everyone for their tips.