SQLite Forum

How to free max heap size on execution of sqlite query using sqlite3_exec?
Which "device", which operating system, which release of sqlite, which schema, which query?

Can you replicate the problem using sqlite shell?

There are basically two possibilities:

a) There is an actual memory leak (indicated by heap memory increasing linearly each time you re-run the query), in which case you need to show that this is happening in sqlite and not in your own code.

b) What you are observing is heap memory increasing to a point where queries can be run by re-using memory space already acquired.