title: Android OpenGL live wallpaper crashes - Mali EGL error?
body: <p>I've got a big problem with my OpenGL based Live Wallpaper project. I managed to move my 2d live wallpaper from canvas to opengl and all looks fine and fast but... damn there's allways something</p>
  
  <p>when I set my livewallpaper and reopen live wallpapers settings menu, chose the same my wallpaper and then return or accept it crashes... but it crashes only on my Samsung Galaxy Note (Android 4.04). It crashes also when i set my wallpaper after some other wallpapers, but allways the same. I tried on Samsung Ace (android 2.37) - and works just fine. So what the hell?</p>
  
  <p>I've made it based on a <a href="http://www.learnopengles.com/how-to-use-opengl-es-2-in-an-android-live-wallpaper/" rel="nofollow">http://www.learnopengles.com/how-to-use-opengl-es-2-in-an-android-live-wallpaper/</a> project. And you know what - original project throws the same error. So is it just SG Note problem. I've been working on this project since 2 months and i've allmost finished - and now I'm a little desperated so please help :)</p>
  
  <pre><code>11-26 20:13:41.853: I/dalvikvm-heap(26738): Grow heap (frag case) to 13.956MB for 1048592-byte allocation
  11-26 20:13:41.873: D/dalvikvm(26738): GC_CONCURRENT freed &lt;1K, 78% free 14064K/63495K, paused 2ms+3ms
  11-26 20:13:43.238: D/dalvikvm(26738): GC_CONCURRENT freed 1667K, 80% free 12786K/63495K, paused 6ms+20ms
  11-26 20:13:46.978: E/SurfaceTextureClient(26738): queueBuffer: error queuing buffer to SurfaceTexture, -19
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_queue_buffer(mali_base_ctx_type*, egl_buffer*):851 [EGL-ERROR] unable to queue buffer (0x3222ec)
  11-26 20:13:46.988: E/SurfaceTextureClient(26738): queueBuffer: error queuing buffer to SurfaceTexture, -19
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_queue_buffer(mali_base_ctx_type*, egl_buffer*):851 [EGL-ERROR] unable to queue buffer (0x2d3fac)
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
  11-26 20:13:47.028: E/SurfaceTextureClient(26738): ISurfaceTexture::setBufferCount(0) returned No such device
  11-26 20:13:47.063: W/dalvikvm(26738): threadid=12: thread exiting with uncaught exception (group=0x40c461f8)
  11-26 20:13:47.068: E/AndroidRuntime(26738): FATAL EXCEPTION: GLThread 11491
  11-26 20:13:47.068: E/AndroidRuntime(26738): java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
  11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1178)
  11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1136)
  11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1463)
  11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
  11-26 20:13:47.123: D/dalvikvm(26738): GC_EXPLICIT freed 178K, 80% free 12779K/63495K, paused 1ms+18ms
  </code></pre>