SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

yaro
Hello,
I built TCl 8.6 with SQLite extension (3.2.0) which I embedded into a C++
application. Because I need SQLite in both TCL and C++ I defined the SQLite
macro of (the extension) to export all the SQLite C API's. So the the built
SQLite DLL library TCL extension exports both the TCL interface as well as
the C++ interface.

While using this SQLite DLL in C++ I created a shared-cache in-memory db
which I once mistakenly did not close. This in-memory db remains in memory
even after I restart/rebuild the C++ application. I know this because I
tried to create the same table with the same connect as before and I get
error "table ... already exists" from SQLite.

I wonder why this is so, because I thought that SQLite will free all its
resources everytime the application closes?

Yaro



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

yaro
Hello,
I have found the cause of the weird behaviour. The in Shared Cache In-Memory
DB isn't persisted, rather the problem is due to a temp file named "file"
that isn't deleted after my application closes. Whenever I delete this file
then everything works fine.

From my search this file ought to be auto deleted by SQLite when closed but
it isn't. Could anyone please provide suggests on how to fix this, my PC has
win7.

Yaro.



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

Clemens Ladisch
yaro wrote:
> the problem is due to a temp file named "file" that isn't deleted after my application closes.

SQLite does not create temp files named "file".


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

Dan Kennedy-4
In reply to this post by yaro
On 11/02/2017 08:50 PM, yaro wrote:
> Hello,
> I have found the cause of the weird behaviour. The in Shared Cache In-Memory
> DB isn't persisted, rather the problem is due to a temp file named "file"
> that isn't deleted after my application closes. Whenever I delete this file
> then everything works fine.
>
>  From my search this file ought to be auto deleted by SQLite when closed but
> it isn't. Could anyone please provide suggests on how to fix this, my PC has
> win7.

How are you enabling URI filenames?

By building with -DSQLITE_USE_URI, or by enabling them globally at
runtime using sqlite3_config(), or by passing the SQLITE_OPEN_URI flag
to sqlite3_open_v2()?

Dan.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

yaro
Dan,
Your question was well composed and illuminating. After going through my
code I realised that I didn't enable URI Filename in any of the ways you
mentioned, my guide to using URI Filename is
https://www.sqlite.org/inmemorydb.html
<https://www.sqlite.org/inmemorydb.html>  

May be that is the cause of my problem.

Yaro.



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: SQLIte Shared Cache In-Memory DB Persists After Application Shutdown

yaro
Thanks Clemens and Dan,
The issue is resolved, it was caused by not setting the URI Filename flag.

Yaro



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users