Michael,

Thank you for your suggestion.  I tried this in the ADO.Net world by adding 
"cache_size=10" to my connection string.  It had a small effect, but it did not 
come close to fixing the problem.  

But you are saying to change it inside the source code of SQLite itself.  This 
is possible, and I will try it, but we have built the SQLite code into a 
standard DLL used by many of our applications.  I would much rather have a way 
to clean up the cache that can be done without having my application use its 
own, custom-built version of SQLite.

RobR






________________________________
From: "Black, Michael (IS)" <[email protected]>
To: General Discussion of SQLite Database <[email protected]>
Sent: Tue, April 27, 2010 3:39:35 PM
Subject: Re: [sqlite] Hypothetical memory consumption question

We just went through this the other day.

You want to change 
# define SQLITE_DEFAULT_CACHE_SIZE  2000

To something smaller since you don't apparently need the cache space.  It will 
only grow to about 3Meg on a 32-bit system apparently.

Try making it 10 or less and you should see your process stop growing fairly 
quickly.


Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems


________________________________

From: [email protected] on behalf of Radcon Entec
Sent: Tue 4/27/2010 2:17 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Hypothetical memory consumption question



Pavel,

Thank you for your reply.  Does data get cached even though I am never 
executing a select statement?

Here's the real world problem:  I am trying to write a service that updates 124 
simple SQLite databases every minute.  The service is written in C#, using 
Visual Studio 2008 and the SQLite ADO.Net Provider 2.0 library from PHX 
Software.  The databases are identical in structure.  There are six tables, of 
which five are very small.  Those tables are the only ones that are ever read, 
and they're only read once, when the service starts up.  The sixth table 
contains three columns.  It is never read.  Every minute, one row is added to 
that table.  The service constantly increases its memory consumption.  Because 
this is a service, unbounded memory growth is not acceptable.  I have commented 
out the call to the SQLiteCommand.ExecuteNonQuery() method.  In that case, the 
service's memory footprint is constant.  Therefore, the problem is either in 
the provider or in SQLite itself.


I am sure that SQLite has been used many times in Windows services and other 
persistent applications.  What is the preferred technique for avoiding this 
unbounded memory growth?  Do I have to close my databases at the end of my loop 
and then reopen them at the start of the next loop?

Thanks again to you and to all who are able to advise me.

RobR


    
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


      
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to