SQLite Forum

memory vs mmap
> But I don't know why Sqlite would need to differentiate between two pointers and must go through a different codepath for mmap files.

I guess that is because a [:memory:][1] database can't  be fully [ACID][2]. When the program exits or crashes, the database is lost, so it is not `Durable`. A :memory: dataabase is so to speak just a volatile page cache without backing store. 

A file backed database (mmap or not) can be durable, with journaling and proper synchronization to permanent storage.

See also [Architecture][3]

[1]: https://www.sqlite.org/inmemorydb.html
[2]: https://www.sqlite.org/transactional.html
[3]: https://www.sqlite.org/arch.html