Closed GoogleCodeExporter closed 9 years ago
Paul, SQLiteStatement instances are cached by default in SQLiteConnection and
not disposed unless removed from cache. So the memory is consumed not only by
every single SQLiteStatement but also by cache entries.
If you'd like SQLiteStatement not be cached, you can set "cached" to false when
using method
http://almworks.com/sqlite4java/javadoc/com/almworks/sqlite4java/SQLiteConnectio
n.html#prepare(java.lang.String, boolean)
Please note that your example of "prepare, step, dispose" - without any bind or
column calls is equal to calling exec.
Also, please note that putting values as literals into SQL is generally a
no-no, so I guess you either have very good reasons to use such an SQL, or you
need to rewrite this part with bind variables (which then would reduce the
number of prepared statements to the number of tables in your DB, and caching
would make sense).
Cheers
Igor
Original comment by ser...@gmail.com
on 31 Jul 2011 at 7:56
Ah thank you, didn't know what I was supposed to do with the SQLiteStatements.
I'm now using a single statement and rebinding it for every insert. It handles
very similar to using exec, i.e. negligible memory usage. Haven't noticed
significant performance increase, but hey, at least I'm using it correctly :-)
Original comment by paul.har...@gmail.com
on 2 Aug 2011 at 2:12
Original issue reported on code.google.com by
paul.har...@gmail.com
on 31 Jul 2011 at 12:59