Hi,
   Any update about this issue? I run almost all device available for
me on android 2.3.x,  all have this problem.


On Apr 13, 8:50 pm, Mario Zechner <badlogicga...@gmail.com> wrote:
> Forgot to add: the problem does not appear on Android < 2.3 (tested on
> Hero 1.5, Droid 2.1.1, HTC Desire HD 2.2.2).
>
> On 13 Apr., 14:31, Mario Zechner <badlogicga...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > i got some reports from users of our framework that opening/closing an
> > OpenGL ES based app would force close with an EGL_BAD_ALLOC after
> > ~20-30 open/close cycles on an Android 2.3 device. To eliminate any
> > problems related to our framework i wrote the simplest GLSurfaceView
> > based app i could come up with:
>
> > package com.badlogic.egl;
>
> > import javax.microedition.khronos.egl.EGLConfig;
> > import javax.microedition.khronos.opengles.GL10;
>
> > import android.app.Activity;
> > import android.opengl.GLSurfaceView;
> > import android.opengl.GLSurfaceView.Renderer;
> > import android.os.Bundle;
> > import android.view.Window;
> > import android.view.WindowManager;
>
> > public class EglBadAlloc extends Activity {
> >         GLSurfaceView view;
>
> >         @Override public void onCreate (Bundle savedInstanceState) {
> >                 super.onCreate(savedInstanceState);
> >                 requestWindowFeature(Window.FEATURE_NO_TITLE);
> >       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
> > WindowManager.LayoutParams.FLAG_FULLSCREEN);
>
> > getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN 
> > );
> >                 view = new GLSurfaceView(this);
> >                 view.setRenderer(new Renderer() {
> >                         @Override public void onDrawFrame (GL10 gl) {
> >                                 gl.glClearColor(1, 0, 0, 1);
> >                                 gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
> >                         }
>
> >                         @Override public void onSurfaceChanged (GL10 gl, 
> > int width, int
> > height) {
> >                         }
>
> >                         @Override public void onSurfaceCreated (GL10 gl, 
> > EGLConfig config)
> > {
> >                         }
> >                 });
>
> >                 setContentView(view);
> >         }
>
> >         @Override public void onPause () {
> >                 super.onPause();
> >                 view.onPause();
> >         }
>
> >         @Override public void onResume() {
> >                 super.onResume();
> >                 view.onResume();
> >         }
>
> > }
>
> > Running this on a Nexus One/Samsung Galaxy S with stock 2.3.3 will
> > eventually result in a force close with the following interesting
> > stack trace:
>
> > 04-13 13:33:24.400: VERBOSE/RenderScript_jni(191): surfaceDestroyed
> > 04-13 13:33:24.460: ERROR/Surface(867): invalid token (identity=335)
> > 04-13 13:33:24.470: ERROR/Surface(867): invalid token (identity=335)
> > 04-13 13:33:24.470: ERROR/Surface(867): invalid token (identity=335)
> > 04-13 13:33:24.470: ERROR/Adreno200-EGL(867): egliGetNativeWindowSize:
> > unable to dequeue native buffer
> > 04-13 13:33:24.470: ERROR/Surface(867): invalid token (identity=335)
> > 04-13 13:33:24.470: ERROR/Surface(867): invalid token (identity=335)
> > 04-13 13:33:24.470: ERROR/Adreno200-EGL(867): egliGetNativeWindowSize:
> > unable to dequeue native buffer
> > 04-13 13:33:24.470: ERROR/Surface(867): invalid token (identity=335)
> > 04-13 13:33:24.480: WARN/dalvikvm(867): threadid=9: thread exiting
> > with uncaught exception (group=0x40015560)
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867): FATAL EXCEPTION:
> > GLThread 41
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867):
> > java.lang.RuntimeException: eglMakeCurrent failed: EGL_BAD_ALLOC
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867):     at
> > android.opengl.GLSurfaceView
> > $EglHelper.throwEglException(GLSurfaceView.java:1080)
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867):     at
> > android.opengl.GLSurfaceView
> > $EglHelper.throwEglException(GLSurfaceView.java:1072)
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867):     at
> > android.opengl.GLSurfaceView
> > $EglHelper.createSurface(GLSurfaceView.java:992)
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867):     at
> > android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:
> > 1335)
> > 04-13 13:33:24.490: ERROR/AndroidRuntime(867):     at
> > android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
> > 04-13 13:33:24.490: WARN/ActivityManager(103):   Force finishing
> > activity com.badlogic.egl/.EglBadAlloc
>
> > To reproduce the issue just open and close (via the backbutton) the
> > app above around ~20 times in succession. The app is cached on 2.3 it
> > seems, The cache memory is growing and eventually the EGL error will
> > appear, force closing the app.
>
> > I looked at the sources of GLSurfaceView for 2.2 and 2.3 (latest AOSP
> > release tag in both cases) and there seem to be some changes in the
> > way EGL context destruction is handled. It seems that one can
> > explicitely request a the context destruction now. Sadly my brain
> > couldn't untangle the logic behind all that yet (and i'm afraid i lack
> > the time to go further down that rabbit hole).
>
> > So, before i log a bug on b.android.com, does anyone see a problem
> > with my above Activity code? Is there any solution that might not
> > require waiting for the next Android release and it's deployment?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to