SQLite Forum

C API for holding shm file in cache memory on Mac OS X and Linux?
Login

C API for holding shm file in cache memory on Mac OS X and Linux?

(1) By 6kEs4Majrd on 2020-06-20 21:57:31 [source]

https://www.sqlite.org/walformat.html

I see this sentence on the above page. Does anybody know what is the underlying C API to achieve this on Mac OS X and Linux? Thanks.

"In fact, if there were a mechanism by which SQLite could tell the operating system to never persist the shm file to disk but always hold it in cache memory, SQLite would use that mechanism to avoid any unnecessary disk I/O associated with the shm file."

(2) By Stephan Beal (stephan) on 2020-06-21 04:29:53 in reply to 1 [link] [source]

I see this sentence on the above page. Does anybody know what is the underlying C API to achieve this on Mac OS X and Linux?

The part "if there were a mechanism" means that such a mechanism does not exist. You seem to be interpreting it as "if such a mechanism is detected on the system."

(3) By Simon Slavin (slavin) on 2020-06-21 22:31:52 in reply to 1 [link] [source]

There's no way to do that.

However, the caching systems used by macOS and Linux are very efficient. If you aren't trying to use all available memory for other things, that information should continue to be in memory, and you can access it without needing access to backing store.