Im currently creating an app for honeycomb, but i'm getting significant problems i'm suspecting is with memory used by the openGL renderer.
Situation is i've got a scrollview that holds multiple container views (can be somewhat much, like 20); those container views each consist of like 6 custom views that have their layertype set to hardware accelerated by this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
(if I don't set it everything gets rendered all messed up with images missing or being drawn at wrong places etc). I also have a videoview that shows a video.
Now when I the app gets destroyed and created again (particularly on rotation) the app just dies a seriously horrible death without any debuggable errors except that the logs show a lot of GCs and loads of other stuff concerning graphics buffers being out of memory and all kinds of stuff dying:
08-01 11:59:03.540: ERROR/libEGL(4435): call to OpenGL ES API with no current context (logged once per thread)
08-01 11:59:20.050: WARN/WindowManager(125): Window freeze timeout expired.
08-01 11:59:20.300: ERROR/InputDispatcher(125): channel '40f8bc80 com.android.launcher/com.android.launcher2.Launcher (server)' ~ Consumer closed input channel or an error occurred. events=0x8
08-01 11:59:20.300: ERROR/InputDispatcher(125): channel '40f8bc80 com.android.launcher/com.android.launcher2.Launcher (server)' ~ Channel is unrecoverably broken and will be disposed!
08-01 11:59:20.300: INFO/ActivityManager(125): Process com.android.launcher (pid 3723) has died.
08-01 11:59:20.300: INFO/WindowManager(125): WINDOW DIED Window{40f8bc80 com.android.launcher/com.android.launcher2.Launcher paused=false}
08-01 11:59:20.300: WARN/WindowManager(125): Failed looking up window
08-01 11:59:20.300: WARN/WindowManager(125): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@40acdc08 does not exist
08-01 11:59:20.300: WARN/WindowManager(125): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9423)
08-01 11:59:20.300: WARN/WindowManager(125): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9414)
08-01 11:59:20.300: WARN/WindowManager(125): at com.android.server.WindowManagerService$WindowState$DeathRecipient.binderDied(WindowManagerService.java:8153)
08-01 11:59:20.300: WARN/WindowManager(125): at android.os.BinderProxy.sendDeathNotice(Binder.java:385)
08-01 11:59:20.300: WARN/WindowManager(125): at dalvik.system.NativeStart.run(Native Method)
08-01 11:59:20.300: INFO/WindowManager(125): WIN DEATH: null
08-01 11:59:21.460: ERROR/MediaPlayer(4435): stop called in state 1
08-01 11:59:21.460: ERROR/MediaPlayer(4435): error (-38, 0)
08-01 11:59:21.490: INFO/OMXCodec(85): [OMX.Nvidia.h264.decode] AVC profile = 66 (Baseline), level = 13
08-01 11:59:21.490: INFO/OMXCodec(85): [OMX.Nvidia.h264.decode] allocating 10 buffers of size 1566720 on input port
08-01 11:59:21.490: INFO/OMXCodec(85): [OMX.Nvidia.h264.decode] allocating 9 buffers from a native window of size 777600 on output port
08-01 11:59:21.520: INFO/WindowManager(125): WIN DEATH: Window{40bad270 RecentsPanel paused=false}
08-01 11:59:21.520: INFO/ActivityManager(125): Process com.android.systemui (pid 177) has died.
08-01 11:59:21.520: WARN/ActivityManager(125): Scheduling restart of crashed service com.android.systemui/.SystemUIService in 1250ms
08-01 11:59:21.520: ERROR/InputDispatcher(125): channel '40b511d8 NotificationPanel (server)' ~ Consumer closed input channel or an error occurred. events=0x8
08-01 11:59:21.520: ERROR/InputDispatcher(125): channel '40b511d8 NotificationPanel (server)' ~ Channel is unrecoverably broken and will be disposed!
08-01 11:59:21.520: INFO/WindowManager(125): WIN DEATH: Window{40b51d98 NotificationPeekWindow paused=false}
08-01 11:59:21.520: INFO/StatusBarManagerService(125): binder died for pkg=com.android.systemui
08-01 11:59:21.520: INFO/WindowManager(125): WIN DEATH: Window{40b58810 StatusBar paused=false}
08-01 11:59:21.530: INFO/ActivityManager(125): Start proc com.android.systemui for restart com.android.systemui: pid=4553 uid=1000 gids={2001, 3003, 3002, 3001}
08-01 11:59:21.530: INFO/WindowManager(125): WIN DEATH: Window{409fd688 InputMethodsPanel paused=false}
08-01 11:59:21.530: INFO/WindowManager(125): WINDOW DIED Window{40b511d8 NotificationPanel paused=false}
08-01 11:59:21.530: WARN/WindowManager(125): Failed looking up window
08-01 11:59:21.530: WARN/WindowManager(125): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@40b50fe8 does not exist
08-01 11:59:21.530: WARN/WindowManager(125): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9423)
08-01 11:59:21.530: WARN/WindowManager(125): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9414)
08-01 11:59:21.530: WARN/WindowManager(125): at com.android.server.WindowManagerService$WindowState$DeathRecipient.binderDied(WindowManagerService.java:8153)
08-01 11:59:21.530: WARN/WindowManager(125): at android.os.BinderProxy.sendDeathNotice(Binder.java:385)
08-01 11:59:21.530: WARN/WindowManager(125): at dalvik.system.NativeStart.run(Native Method)
08-01 11:59:21.530: INFO/WindowManager(125): WIN DEATH: null
08-01 11:59:21.540: WARN/GraphicBufferAllocator(125): alloc(720, 720, 842094169, 00002100, ...) failed -12 (Out of memory)
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): Allocated buffers:
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x1c1a08: 150.00 KiB | 800 ( 800) x 48 | 2 | 0x00000133
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x225fd0: 3850.00 KiB | 800 ( 800) x 1232 | 1 | 0x00000300
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x22d198: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x2a5250: 398.19 KiB | 360 ( 368) x 277 | 1 | 0x00000300
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x2ae858: 5280.00 KiB | 1920 (1920) x 1408 | 4 | 0x00000133
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x3510f0: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x3b0958: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x40e238: 150.00 KiB | 800 ( 800) x 48 | 2 | 0x00000133
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x41a3c0: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x5bfe60: 398.19 KiB | 360 ( 368) x 277 | 1 | 0x00000300
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): Total allocated: 12251.38 KB
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): Nvidia Gralloc
08-01 11:59:21.540: ERROR/SurfaceFlinger(125): Layer::requestBuffer(this=0x35dab0), index=5, w=720, h=720 failed (Out of memory)
08-01 11:59:21.540: WARN/GraphicBufferAllocator(125): alloc(800, 1232, 1, 00000300, ...) failed -12 (Out of memory)
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): Allocated buffers:
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x1c1a08: 150.00 KiB | 800 ( 800) x 48 | 2 | 0x00000133
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x225fd0: 3850.00 KiB | 800 ( 800) x 1232 | 1 | 0x00000300
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x22d198: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x2a5250: 398.19 KiB | 360 ( 368) x 277 | 1 | 0x00000300
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x2ae858: 5280.00 KiB | 1920 (1920) x 1408 | 4 | 0x00000133
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x3510f0: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x3b0958: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x40e238: 150.00 KiB | 800 ( 800) x 48 | 2 | 0x00000133
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x41a3c0: 506.25 KiB | 720 ( 720) x 720 | 32315659 | 0x00002100
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): 0x5bfe60: 398.19 KiB | 360 ( 368) x 277 | 1 | 0x00000300
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): Total allocated: 12251.38 KB
08-01 11:59:21.540: DEBUG/GraphicBufferAllocator(125): Nvidia Gralloc
08-01 11:59:21.540: ERROR/SurfaceFlinger(125): Layer::requestBuffer(this=0x5b8568), index=1, w=800, h=1232 failed (Out of memory)
08-01 11:59:21.560: ERROR/InputDispatcher(125): channel '40f0e030 com.myapp/com.myApp.MyActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
08-01 11:59:21.560: ERROR/InputDispatcher(125): channel '40f0e030 com.myapp/com.myApp.MyActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
08-01 11:59:21.560: INFO/WindowManager(125): WINDOW DIED Window{40f0e030 com.myapp/com.myApp.MyActivity paused=false}
08-01 11:59:21.560: WARN/WindowManager(125): Force-removing child win Window{40f21568 SurfaceView paused=false} from container Window{40f0e030 com.myapp/com.myApp.MyActivity paused=false}
08-01 11:59:21.570: WARN/AudioSystem(215): AudioFlinger server died!
08-01 11:59:21.570: WARN/AudioSystem(215): AudioPolicyService server died!
08-01 11:59:21.570: INFO/ServiceManager(80): service 'media.audio_flinger' died
08-01 11:59:21.570: INFO/ServiceManager(80): service 'media.player' died
08-01 11:59:21.570: INFO/ServiceManager(80): service 'media.camera' died
08-01 11:59:21.570: INFO/ServiceManager(80): service 'media.audio_policy' died
08-01 11:59:21.570: WARN/IMediaDeathNotifier(125): media server died
08-01 11:59:21.570: WARN/AudioSystem(125): AudioPolicyService server died!
08-01 11:59:21.570: INFO/ActivityManager(125): Process com.myapp (pid 4435) has died.
08-01 11:59:21.570: WARN/WindowManager(125): Failed looking up window
08-01 11:59:21.570: WARN/WindowManager(125): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@41041880 does not exist
08-01 11:59:21.570: WARN/WindowManager(125): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9423)
08-01 11:59:21.570: WARN/WindowManager(125): at com.android.server.WindowManagerService.windowForClientLocked(WindowManagerService.java:9414)
08-01 11:59:21.570: WARN/WindowManager(125): at com.android.server.WindowManagerService$WindowState$DeathRecipient.binderDied(WindowManagerService.java:8153)
08-01 11:59:21.570: WARN/WindowManager(125): at android.os.BinderProxy.sendDeathNotice(Binder.java:385)
08-01 11:59:21.570: WARN/WindowManager(125): at dalvik.system.NativeStart.run(Native Method)
08-01 11:59:21.570: INFO/WindowManager(125): WIN DEATH: null
08-01 11:59:21.570: INFO/ActivityManager(125): Start proc com.android.launcher for activity com.android.launcher/com.android.launcher2.Launcher: pid=4559 uid=10025 gids={}
08-01 11:59:21.650: INFO/ActivityThread(4559): Pub com.android.launcher2.settings: com.android.launcher2.LauncherProvider
So the question is, how can i make sure this doesn't happen? And specifically:
Hardware layers are very costly in terms of memory. You should only enable them temporarily on views (for the duration of an animation for instance.) To get in the state you are describing your app must use more than 256+32 MB of video memory on a Xoom tablet. Also, if you are using WebView, be careful as it uses quite a bit of memory itself.
User contributions licensed under CC BY-SA 3.0