5.6.0f3 - Crash when exiting app, out of memory, only affecting a device on Android 6.0.1

Hi there,

We’ve got an out of memory crash happening when exiting our android app. It appears to be when the OS tries to make a screenshot of the app so it can put the app in to the background mode. This wasn’t occurring before we upgraded to 5.6 and it only affects a Samsung S5 running 6.0.1.

We have another device a Samsung Tab running 5.0 and it’s fine.

I tried to submit a bug report but the project is too large and the bug reporter ironically keeps crashing after uploading a couple of hundred mb. I tried building and running an apk from an empty project using 5.6 but the problem device does not crash on exit of this app. So it’s hard to know where the blame lies and I can’t create a bug report with a simpler project.

The crash is so strange. I’m able to play our game for hours, loading and dumping 100’s of memory hungry scenes and the device holds up. It’s only when it exits for whatever reason (switching out to a browser, or just hitting the home button) then the app crashes. I’ll attach the log I captured using logcat to see if that helps.

Any help much appreciated, thanks!!!

04-14 11:07:55.214 14423 14423 E AndroidRuntime: FATAL EXCEPTION: main
04-14 11:07:55.214 14423 14423 E AndroidRuntime: Process: [### edited, this had our bundle id here ###], PID: 14423
04-14 11:07:55.214 14423 14423 E AndroidRuntime: java.lang.Error: FATAL EXCEPTION [main]
04-14 11:07:55.214 14423 14423 E AndroidRuntime: Unity version : 5.6.0f3
04-14 11:07:55.214 14423 14423 E AndroidRuntime: Device model : samsung SM-G900I
04-14 11:07:55.214 14423 14423 E AndroidRuntime: Device fingerprint: samsung/kltedv/klte:6.0.1/MMB29M/G900IDVU1CPL1:user/release-keys
04-14 11:07:55.214 14423 14423 E AndroidRuntime:
04-14 11:07:55.214 14423 14423 E AndroidRuntime: Caused by: java.lang.OutOfMemoryError: Failed to allocate a 26211852 byte allocation with 10635816 free bytes and 10MB until OOM
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.graphics.Bitmap.nativeCreate(Native Method)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.graphics.Bitmap.createBitmap(Bitmap.java:975)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.graphics.Bitmap.createBitmap(Bitmap.java:946)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.graphics.Bitmap.createBitmap(Bitmap.java:877)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:753)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at com.unity3d.player.i.onLayoutChange(Unknown Source)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.View.layout(View.java:17947)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5812)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.FrameLayout.onLayout(FrameLayout.java:281)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.View.layout(View.java:17938)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5812)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.View.layout(View.java:17938)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5812)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.widget.FrameLayout.onLayout(FrameLayout.java:281)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:3193)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.View.layout(View.java:17938)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5812)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2666)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2367)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1437)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7397)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:695)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:631)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7224)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
04-14 11:07:55.214 14423 14423 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

1 Like

Anyone have any ideas what’s going on here?

I’ve just tested the exact same app running on a Samsung S6 that is on the same OS 6.0.1 and it doesn’t crash. It’s only the S5 at this point, but it’s always at a predictable point ie. exiting the app. I’m left wondering if there’s something odd about how the unity app is rendering on the S5 or something odd about the GPU, and that at the time where the OS tries to take a screenshot it trips it up causing the out of memory crash. I don’t know what else it could be because the device has 2GB of RAM and runs our app for hours fine with no issue.

I’m really stumped on what to do to resolve this =(

But at least that test ^ is telling me that the issue isn’t in the OS version.

hoping someone has a clue about what this could be… thanks

1 Like

Experiencing same issue on LG G2 with Android 4.4.2…any tips from Unity Developers?

Sounds like a bug with the static splash screen. A bug report would be really appreciated.

Not sure if this is related, but after upgrading to Unity 5.6.0f3 we’re getting out of memory crashes immediately on launch when we have a static splash screen image selected. Android 4.4.2. No issues on Unity 5.4.

E/AndroidRuntime(24564): Caused by: java.lang.OutOfMemoryError

E/AndroidRuntime(24564): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)

E/AndroidRuntime(24564): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:683)

E/AndroidRuntime(24564): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:513)

E/AndroidRuntime(24564): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:541)

E/AndroidRuntime(24564): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:571)

E/AndroidRuntime(24564): at com.unity3d.player.i.onLayoutChange(Unknown Source)

E/AndroidRuntime(24564): at android.view.View.layout(View.java:15754)

E/AndroidRuntime(24564): at android.view.ViewGroup.layout(ViewGroup.java:4868)

E/AndroidRuntime(24564): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)

E/AndroidRuntime(24564): at android.widget.FrameLayout.onLayout(FrameLayout.java:388)

E/AndroidRuntime(24564): at android.view.View.layout(View.java:15745)

E/AndroidRuntime(24564): at android.view.ViewGroup.layout(ViewGroup.java:4868)

E/AndroidRuntime(24564): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)

E/AndroidRuntime(24564): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)

E/AndroidRuntime(24564): at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)

E/AndroidRuntime(24564): at android.view.View.layout(View.java:15745)

E/AndroidRuntime(24564): at android.view.ViewGroup.layout(ViewGroup.java:4868)

E/AndroidRuntime(24564): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)

E/AndroidRuntime(24564): at android.widget.FrameLayout.onLayout(FrameLayout.java:388)

E/AndroidRuntime(24564): at android.view.View.layout(View.java:15745)

E/AndroidRuntime(24564): at android.view.ViewGroup.layout(ViewGroup.java:4868)

E/AndroidRuntime(24564): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2330)

E/AndroidRuntime(24564): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2043)

E/AndroidRuntime(24564): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)

E/AndroidRuntime(24564): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6567)

E/AndroidRuntime(24564): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)

E/AndroidRuntime(24564): at android.view.Choreographer.doCallbacks(Choreographer.java:603)

E/AndroidRuntime(24564): at android.view.Choreographer.doFrame(Choreographer.java:573)

E/AndroidRuntime(24564): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)

E/AndroidRuntime(24564): at android.os.Handler.handleCallback(Handler.java:733)

E/AndroidRuntime(24564): at android.os.Handler.dispatchMessage(Handler.java:95)

E/AndroidRuntime(24564): at android.os.Looper.loop(Looper.java:136)

E/AndroidRuntime(24564): at android.app.ActivityThread.main(ActivityThread.java:5476)

E/AndroidRuntime(24564): at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(24564): at java.lang.reflect.Method.invoke(Method.java:515)

E/AndroidRuntime(24564): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)

E/AndroidRuntime(24564): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)

E/AndroidRuntime(24564): at dalvik.system.NativeStart.main(Native Method)

I’m having the same issue.
My Android build stopped working after upgrading from Unity 5.5.2 to Unity 5.6.0f3

E/AndroidRuntime(17077): FATAL EXCEPTION: main
E/AndroidRuntime(17077): Process: com.studioavante.xxxxxxx, PID: 17077
E/AndroidRuntime(17077): java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime(17077): Unity version     : 5.6.0f3
E/AndroidRuntime(17077): Device model      : samsung GT-I9505
E/AndroidRuntime(17077): Device fingerprint: samsung/jfltevj/jflte:5.0.1/LRX22C/XXXXXXXXXX:user/release-keys
E/AndroidRuntime(17077):
E/AndroidRuntime(17077): Caused by: java.lang.OutOfMemoryError: Failed to allocate a 11059212 byte allocation with 4122724 free bytes and 3MB until OOM
E/AndroidRuntime(17077):     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
E/AndroidRuntime(17077):     at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime(17077):     at android.graphics.Bitmap.createBitmap(Bitmap.java:939)
E/AndroidRuntime(17077):     at android.graphics.Bitmap.createBitmap(Bitmap.java:912)
E/AndroidRuntime(17077):     at android.graphics.Bitmap.createBitmap(Bitmap.java:843)
E/AndroidRuntime(17077):     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:719)
E/AndroidRuntime(17077):     at com.unity3d.player.i.onLayoutChange(Unknown Source)
...
1 Like

Guessed right!
I reduced my splash screen texture Max Size from 2048 to 1024 and it stopped crashing!

3052042--229021--Screen Shot 2017-04-29 at 15.57.33.png

1 Like

Something is definitely funky with static splashes in Unity 5.6. Removing (or significantly downsizing) the splash does correct the issue, but of course this leaves you with a lower resolution image. Any workarounds or ETA for a patch fix, Unity team?

Experiencing the same issue, looking forward to a fix.

1 Like

Looks like android issue. May be new version using more memory.

1 Like

Confirmed-- any word on a fix? We can’t deploy to Android until this one is resolved. Thank you!

Can someone please submit a bug report - we don’t have one yet.

1 Like

Submitted.

Create empty Android project, save empty scene, add empty scene to build, add large uncompressed static splash (in this case 2048x2048), build, observe out of memory crash.

1 Like

https://issuetracker.unity3d.com/issues/android-application-crashes-on-start-with-high-resolution-of-static-splash-image

“Won’t Fix” ? What is going on here? So we can’t have a static splash that’s at or above the native resolution of an average modern device? This issue does not exist in Unity 5.5 and lower.

I’m already starting to notice Unity games live on the app store that are booting up to blank screens because they can’t build with a static splash anymore. This either needs to get fixed, or we need an option to disable background blur on the new splash screens so that we can recreate a normal static splash.

I’d like to hear what Unity has to say about that too.
It will crash. And you don’t care.

1 Like

They aren’t paying attention to the details of this report.

This is not an issue of memory abuse. This is a bug with the static splash in Unity 5.6.

The exact same splash runs just fine in Unity 5.5 and lower. If we apply the same image to the new non-static splash, it runs. If we put the same image in the scene, it runs.

Again: This is not an issue of memory abuse. This is a bug with the static splash in Unity 5.6.

I reactivated the bug - the developer was too fast resolving it :slight_smile: We’ll investigate more.

The static splash screen is new (reimplemented) in 5.6, so it definitely has nothing to do with 5.5.

2 Likes

Thank you!! Very glad to have you on top of it. Looking forward to a resolution.