How to portably extend a file accessed using mmap()

前端 未结 3 1133
你的背包
你的背包 2020-12-23 10:21

We\'re experimenting with changing SQLite, an embedded database system, to use mmap() instead of the usual read() and write() calls to access the database file on disk. Usin

3条回答
  •  渐次进展
    2020-12-23 11:03

    1. I think #2 is the best currently available solution. In addition to this, on 64bit systems you may create your mapping explicitly at an address that OS would never choose for an mapping (for example 0x6000 0000 0000 0000 in Linux) to avoid the case that OS cannot place the new mapping immediatly after the first one.

    2. It is always safe to unmap mutiple mappinsg with a single munmap call. You can even unmap a part of the mapping if you wish to do so.

提交回复
热议问题