On 7/25/17, Brendan E. Coughlan <[email protected]> wrote:
>
> I compiled it with SQLite 3.19.3 under Visual Studio 2017.
>
> If I supply test.db as a command line parameter / file name (and test.db
> doesn't exist yet) the size of test.db, the size of test.db.journal and
> the program's memory usage reach a combined maximum a little short of 2MB.

I get 288KB on Linux...

>
> If I replace the supplied file name by :memory:, the program uses all
> available memory and eventually runs into a memory allocation error.
>

Memory usage tops out at 2,066,287,984 for me.  That is 7000 times
more memory, though...

> Am I doing something wrong and if yes what?
>

Because of the way you have structured your SAVEPOINTs, the statement
log (used to ROLLBACK TO a prior savepoint) must add at least one new
page for each of your 500K UPDATEs.  When the database file is on
disk, the statement log is a temporary file on disk which you are not
noticing.  But when the database file is ":memory:" the statement log
is also in memory.  500K transactions at 4KB per page accounts for
most of the 2GB of memory used.

-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to