SQLite Forum

How to free max heap size on execution of sqlite query using sqlite3_exec?
Login
Since you seem to have full c++ support, try compiling your application for a linux host. Then run it using valgrind to detect and display memory leaks. Once you have fixed those, see what it does on the target device.

I don't do c++, but from what you have shown your code does seem awfully verbose.

I also suggest you use NOT NULL DEFAULT clauses in your schema to avoid cluttering up your queries with IFNULL calls.