> For the complete documentation index, see [llms.txt](https://xlswriter-docs.viest.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xlswriter-docs.viest.me/zhong-wen-jian-ti/memory.md).

# 内存模式

xlswriter 提供两种写入内存策略：

* **常规模式** —— 整个工作簿数据保留在内存中，速度最快，但内存占用与数据量成正比。
* [**固定内存模式**](/zhong-wen-jian-ti/memory/fixed-memory.md) —— 数据按行落盘，内存中只保留最新一行；无论文件大小，峰值内存通常 <1 MB。导出百万级行数据时强烈推荐。

当数据量可能超出 `memory_limit` 时，应优先选择固定内存模式。
