{
  "id": "python/numpy-memory-allocation",
  "signature": "numpy.core._exceptions._ArrayMemoryError: Unable to allocate 15.3 GiB for an array with shape (45000, 45000) and data type float64",
  "signature_zh": "numpy.core._exceptions._ArrayMemoryError：无法为形状 (45000, 45000)、数据类型 float64 的数组分配 15.3 GiB 内存",
  "regex": "numpy\\.core\\._exceptions\\._ArrayMemoryError:\\ Unable\\ to\\ allocate\\ 15\\.3\\ GiB\\ for\\ an\\ array\\ with\\ shape\\ \\(45000,\\ 45000\\)\\ and\\ data\\ type\\ float64",
  "domain": "python",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "Requested array exceeds available RAM; often from dense distance matrices or cross joins.",
  "root_cause_type": "generic",
  "root_cause_zh": "请求的数组超过可用内存；常由稠密距离矩阵或笛卡尔积引起。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Frees only a few GB; array still too large",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Massive slowdown, may still OOM",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use float32: np.zeros((n, m), dtype=np.float32)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Chunk with sklearn.metrics.pairwise_distances_chunked or use sparse matrices",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}