SQLite Forum

Under what circumstances can OOM occur when executing a query
Login

Under what circumstances can OOM occur when executing a query

(1) By anonymous on 2021-05-05 06:50:26 [source]

The Background

Under Windows I have a 32bit process (so 2GB or so adddressible memory) that is getting an out of memory error when executing the first SQLite3Step.

This is using functionality (SQLite wrappers etc that I wrote) that has been running correctly (unchanged) for 6 years.

The query is an extension of an existing query (adding more results columns) and is reasonably complex (using multiple CTEs) and should return 100s of columns. It works correctly when a small (several 100) rows are returned but gets an OOM when 1000 rows would be returned.

The data has no blobs or anything weird that might take up a lot of memory.... just integers and text. There are no triggers.

The Question

Sounds a stupid question but under what circumstances could an OOM error occur in the SQLite3.dll? (My hope is that somehow I am opening the database or configuring the connection in a way which stops SQLite from “spooling” results to disk and it is somehow trying to hold everything in memory.

Before people ask.... I cannot share the SQL or data.... so unfortunately this is a more logical thinking exercise concerning what would cause SQLite to try and do everything in memory and not write temp stuff to disk.

Hopefully someone has an idea that will point me in the right direction to identify what I have done wrong when I created the wrapper library code 6 years ago....