SQLITE_NOMEM: out of memory
SQLite couldn't allocate memory it needed to continue. Usually the process is out of memory, or a heap limit was set too low.
- Result code
SQLITE_NOMEM- Name
7- Category
- Primary result codes
What it means
SQLITE_NOMEM (7) means an internal call to sqlite3_malloc() or sqlite3_realloc() failed when the memory was required to continue. SQLite is designed to fail cleanly here, rolling back the statement without corrupting the database.
Common causes
- The process or container hit its memory limit.
- A soft or hard heap limit set with
sqlite3_soft_heap_limit64()orsqlite3_hard_heap_limit64(), orPRAGMA hard_heap_limit. - A query building a huge in-memory result: a sort or
GROUP BYwithout an index, ortemp_store = MEMORYwith a large intermediate result. - A very large
cache_sizesetting.
How to fix it
-
Check memory limits on the process or container, and any heap limit the application sets.
PRAGMA soft_heap_limit; PRAGMA hard_heap_limit;
-
Let large temporary results go to disk instead of memory, and reduce the page cache if it is very large.
PRAGMA temp_store = FILE; PRAGMA cache_size = -64000; -- about 64 MB
-
Add indexes so sorts and groupings don't need to hold everything in memory.
Related errors
SQLITE_FULLdatabase or disk is full701SQL Server: Insufficient memory in resource poolORA-04031Oracle: unable to allocate bytes of shared memory
More primary result codes errors
SQLITE_ERRORSQL logic errorSQLITE_PERMaccess permission deniedSQLITE_ABORTquery abortedSQLITE_BUSYdatabase is lockedSQLITE_LOCKEDdatabase table is lockedSQLITE_READONLYattempt to write a readonly databaseSQLITE_INTERRUPTinterruptedSQLITE_IOERRdisk I/O error
The code and message text are from the SQLite result and error codes documentation. Browse the full SQLite error list or search every database error.
Work on SQLite in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQLite and the other databases you use.