繁体   English   中英

sqlite C\C++ 库是否将 DB 文件保留为内存映射文件? 是否有可能做到这一点?

[英]Does sqlite C\C++ library keep DB file as Memory-mapped file? and is it possible to make it do so?

所以我想知道 sqlite C/C++ API 如何保持打开的 DB:它是否使用内存映射文件? 或者如何让它这样做?

是的,它确实。 只需搜索 sqlite3.c 的CreateFileMapping

默认情况下,SQLite 使用 memory 映射共享 memory 文件,该文件仅用于 WAL 日志模式。 As per SQLite documentation https://sqlite.org/mmap.html , we can set PRAGMA mmap_size to force SQLite to use memory mapped file i/o in other modes as well. 但是,如果 SQLite 无法访问 memory 中的 map 文件,则会回退到常规文件 i/o。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM