小奈博客 - 技术笔记
type: channel
link: https://naiblog.cn/index.php/category/%E6%8A%80%E6%9C%AF%E7%AC%94%E8%AE%B0/
items: 解决开发遇到百度地图组件内存溢出问题

解决开发遇到百度地图组件内存溢出问题
type: item
date: 2026-05-17T17:53:20+08:00
description: 原报错:Uncaught RangeError: WebAssembly.Memory(): could not allocate memory 解决办法：添加 mapInstanceRef.current 检查 const clearCurrentOverlays = () => { if (!mapInstanceRef.current) return; currentOverlayRef.current.forEach(overlay => { mapInstanceRef.current.removeOverlay(overlay); }); currentOverlayRef.current = [];};