Hi Clive,


To:   [email protected]
cc:    (bcc: clive/Emultek)

Subject:  Re: [sqlite] Memory usage (3.1.0 alpha)



Hi Clive,

[EMAIL PROTECTED] wrote:



I am benchmarking sqlite3 as a potential database for Windows and embedded
applications.
I am running the following code in a Rapid development environment that calls
the equivalent sqlite3 functions
in a Window's DLL that I built from the release .
I am seeing that memory usage goes up and up with every loop, until Windows


runs


out of virtual memory.
Am I doing something wrong?

while(true)
   SQL exec: 'BEGIN TRANSACTION';
   for <Integer:i> from 1 to 1000 step 1
        SQL query: 'INSERT INTO Contacts values(''aaa'',''bbb'',''4'')';
   SQL exec: 'COMMIT TRANSACTION';






It looks like you've wrapped it in some sort of Visual Basic.  Is that true?

If you are using the sqlite3_prepare/sqlite3_step/sqlite3_finalize API,
yhe behavior you experience may be because you don't call
sqlite3_finalize.  Do you use that API?

HTH

Ulrik P.




[EMAIL PROTECTED] wrote:


The environment I am using is RapidPlus. It makes calls directly to the DLL. I
changed the sqlite3 functions just to return in order to eliminate the
possibility of it being a problem with the environment, and there was no memory
loss.


Sorry, I don't understand what you mean. Have you changed the SQLite3 code at all?

Since I am using sqlite3_exec I do not think I need to use sqlite3_finalize.
Is that correct?

That is correct.


Perhaps the normal behaviour of sqlite3 is to use system memory until there is
non left?



No, that is not the case.

I cannot find a #define that specifies how many database pages are
cached in memory.


It is not a #define, it's PRAGMA:

http://www.sqlite.org/pragma.html

Search the page for "cache_size" and "default_cache_size".


The behavior you experience would be exhibited if:

1) The sqlite3_exec function returned an error, and you did not call sqlite3_free on the error message. (See http://www.sqlite.org/capi3ref.html#sqlite3_exec )

2) You sqlite3_open'ed a new connection every time without sqlite3_close'ing it.

That's all I can think of right now.

HTH

Ulrik



Reply via email to