SQLite Forum

How to free max heap size on execution of sqlite query using sqlite3_exec?
Login
To Gunter's question, "Have you checked to see if each execution of the query adds about the same amount to heap memory?", answer was:

> Depending on number of records it increases

In other words, "No, allocated memory does not appear to grow approximately linearly as a query is repeated."

You have not described a memory "leak". Nor have you shown in what manner memory allocation increases over time. Hence, nobody can distinguish between something abnormal or objectionable and expectable, ordinary allocation growth toward a semi-stable state.

To Gunter's question, "Can you provide a minimal example (schema and queries in plain SQL) that illustrates the problem?", answer was:

> I must have to check this thing in my running application on same device

Until you provide enough information for somebody else to observe your (not quite) reported problem, the assumption by others will be that what you see is a feature of your application rather than a deficiency of the SQLite library.

You may find this [doc on SQLite memory allocation](https://sqlite.org/malloc.html) useful, particularly the configuration and debug tips.