On Fri, 13 Feb 2009 09:22:42 -0800, ed <epdm...@gmail.com>
wrote in General Discussion of SQLite Database
<sqlite-users@sqlite.org>:

>any help on this would be appreciated.
>thanks,
>ed

Perhaps your question is too general to react upon.

>---------- Forwarded message ----------
>
>Hello,I have an application that is calling sqlite3_open() 
>in one thread and sqlite3_close() in a different thread.
>The db's can potentially be opened and closed many times 
>during execution of my app.

Opening and closing all the time would indicate a bad
program structure. Opening a database means the schema has
to be interpreted. That takes time, especially if it
contains more than a few simple tables. 

>Could this potentially introduce any problems?

As far as I know not with recent versions of SQLite.
Once upon a time, there was a problem with locks  when using
threads, where locks owned by one thread couldn't be
released in another thread in some OS implementations of
threads / locks.

If you have any doubt, you could try to postpone opening the
database and have it done by the thread that will close it.

>In particular, I am trying to determine why sqlite3 
>is consuming increasingly more memory as the db's 
>are opened and closed (as seen with
>valgrind's massif).

Doesn't valgrind indicate which allocations aren't freed?
Perhaps you buffer result sets in your program and forget to
release them? Do you sqlite3_reset() and sqlite3_finalize()?
Do you check the return code of sqlite3_close() ?
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to