{
  "id": "flutter/isolate-memory-limit",
  "signature": "Unhandled exception: OutOfMemoryError: Isolate allocation failed due to memory limit",
  "signature_zh": "未处理的异常：OutOfMemoryError：由于内存限制，Isolate 分配失败",
  "regex": "Unhandled exception: OutOfMemoryError: Isolate allocation failed due to memory limit",
  "domain": "flutter",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "A Dart isolate exceeded its memory budget (default ~100MB on mobile), often caused by loading large datasets or infinite recursion within the isolate without proper disposal.",
  "root_cause_type": "generic",
  "root_cause_zh": "Dart Isolate 超出了其内存预算（移动端默认约 100MB），通常是由于在 Isolate 内加载大型数据集或无限递归而未正确释放所致。",
  "versions": [
    {
      "version": "Flutter 3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Dart 3.0",
      "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": "iOS 15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The `maxMemory` parameter is not supported on mobile platforms; the limit is enforced by the operating system and cannot be increased by the app.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "`Compute` still runs in an isolate with the same memory constraints; passing a large list directly will still cause OOM.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Assertions do not prevent OOM; they only check logical conditions. Memory allocation failures are not caught by assertions.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Process data in chunks: split the large dataset into smaller batches and send each batch to the isolate using `SendPort.send`. Example: `for (var i = 0; i < data.length; i += chunkSize) { isolateSendPort.send(data.sublist(i, min(i+chunkSize, data.length))); }`",
      "success_rate": 0.85,
      "how": "Process data in chunks: split the large dataset into smaller batches and send each batch to the isolate using `SendPort.send`. Example: `for (var i = 0; i < data.length; i += chunkSize) { isolateSendPort.send(data.sublist(i, min(i+chunkSize, data.length))); }`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use streaming isolates with `Isolate.stream` or `ReceivePort` to handle data incrementally, releasing memory after each chunk is processed.",
      "success_rate": 0.8,
      "how": "Use streaming isolates with `Isolate.stream` or `ReceivePort` to handle data incrementally, releasing memory after each chunk is processed.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Optimize data structures: replace large lists with iterators or lazy generators that don't load all data into memory at once.",
      "success_rate": 0.75,
      "how": "Optimize data structures: replace large lists with iterators or lazy generators that don't load all data into memory at once.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Process data in chunks: split the large dataset into smaller batches and send each batch to the isolate using `SendPort.send`. Example: `for (var i = 0; i < data.length; i += chunkSize) { isolateSendPort.send(data.sublist(i, min(i+chunkSize, data.length))); }`",
    "Use streaming isolates with `Isolate.stream` or `ReceivePort` to handle data incrementally, releasing memory after each chunk is processed.",
    "Optimize data structures: replace large lists with iterators or lazy generators that don't load all data into memory at once."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://api.dart.dev/stable/dart-isolate/Isolate-class.html",
  "official_doc_section": null,
  "error_code": "OutOfMemoryError",
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}