{
  "id": "android/gl-error-out-of-memory",
  "signature": "E/libEGL: call to OpenGL ES API with no current context (logged once per thread). E/libGLESv2: GL_OUT_OF_MEMORY",
  "signature_zh": "E/libEGL：在没有当前上下文的情况下调用 OpenGL ES API（每个线程仅记录一次）。 E/libGLESv2：GL_OUT_OF_MEMORY",
  "regex": "E/libEGL.*call to OpenGL ES API with no current context.*|GL_OUT_OF_MEMORY",
  "domain": "android",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "OpenGL ES context is lost or not properly initialized before making API calls, often due to texture memory exhaustion or incorrect threading.",
  "root_cause_type": "generic",
  "root_cause_zh": "在调用 API 之前 OpenGL ES 上下文丢失或未正确初始化，通常是由于纹理内存耗尽或线程错误。",
  "versions": [
    {
      "version": "Android 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase heap size in the manifest with android:largeHeap=\"true\"",
      "why_fails": "GL_OUT_OF_MEMORY is GPU memory related, not Java heap; largeHeap only affects Dalvik/ART heap, not GPU memory.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce texture dimensions to 0x0 to free memory",
      "why_fails": "Zero-sized textures are invalid and cause GL errors; textures must have positive dimensions.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Call eglMakeCurrent in a background thread without synchronization",
      "why_fails": "OpenGL contexts are not thread-safe; making current from a background thread while the UI thread uses the same context causes crashes.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the GL context is current before any GL call: run all GL operations on the same thread where the GLSurfaceView.Renderer is active. Use GLSurfaceView.queueEvent() to post GL commands on the renderer thread. Example: glSurfaceView.queueEvent(() -> { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); });",
      "success_rate": 0.85,
      "how": "Ensure the GL context is current before any GL call: run all GL operations on the same thread where the GLSurfaceView.Renderer is active. Use GLSurfaceView.queueEvent() to post GL commands on the renderer thread. Example: glSurfaceView.queueEvent(() -> { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); });",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce texture memory usage by compressing textures (e.g., use ETC2 or ASTC format) and calling GLES20.glDeleteTextures() for unused textures. Monitor with android.util.Log and check GLES20.glGetError() after each call.",
      "success_rate": 0.75,
      "how": "Reduce texture memory usage by compressing textures (e.g., use ETC2 or ASTC format) and calling GLES20.glDeleteTextures() for unused textures. Monitor with android.util.Log and check GLES20.glGetError() after each call.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Recreate the GL context when it's lost by overriding onSurfaceCreated() in the Renderer and reinitializing all textures and shaders there.",
      "success_rate": 0.8,
      "how": "Recreate the GL context when it's lost by overriding onSurfaceCreated() in the Renderer and reinitializing all textures and shaders there.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure the GL context is current before any GL call: run all GL operations on the same thread where the GLSurfaceView.Renderer is active. Use GLSurfaceView.queueEvent() to post GL commands on the renderer thread. Example: glSurfaceView.queueEvent(() -> { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); });",
    "Reduce texture memory usage by compressing textures (e.g., use ETC2 or ASTC format) and calling GLES20.glDeleteTextures() for unused textures. Monitor with android.util.Log and check GLES20.glGetError() after each call.",
    "Recreate the GL context when it's lost by overriding onSurfaceCreated() in the Renderer and reinitializing all textures and shaders there."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.android.com/guide/topics/graphics/opengl",
  "official_doc_section": null,
  "error_code": "GL_OUT_OF_MEMORY (0x0505)",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2023-04-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}