SQLite Forum

Temporary data when running out of memory

Temporary data when running out of memory

(1) By anonymous on 2020-05-22 03:44:31 [source]

Hi, if I set the SQLITE_TEMP_STORE compilation option to 2 (and don't use the temp_store PRAGMA) or 3, and run out of main memory, does SQLite autonomously write temporary data to the disk or is it left to the operating system to swap memory to disk (or not if it's marked as not swappable)?

(2) By Keith Medcalf (kmedcalf) on 2020-05-22 05:14:16 in reply to 1 [link] [source]

No. Yes and correct.

In those instances you have told SQLite3 to not manage temporary storage and to instead use allocated memory. Unless you have made provision otherwise, this will be memory obtained from the standard C library "malloc" function and however the Operating System chooses to allocate and manage that memory is up to the Operating System and the Operating System will continue to allocate memory however it has been told to do so up to whatever limit has been set (by whatever means you set it -- externally to the SQLite3 library) until none is left.