b.bum wrote:
> What changed in SQLite3 such that the stack size is significantly larger for
> common operations?
>

Version 3 supports databases with different page sizes. The routine
in question (the "balance" routine in btree.c) has always needed
stack space that is roughly 10x the size of one database page.
In version 2, the database page size was fixed at compile-time to
1024 bytes.  So the stack space needed was about 10K.  Version 3
can read a database with any page size up to SQLITE_MAX_PAGE_SIZE,
currently set to 8192, IIRC.  So we need about 80K of space in
the balancer.  You can raise SQLITE_MAX_PAGE_SIZE as large as
65536 if you want, but then you really need a lot of stack...

The balance routine needs 10x the page size of space to do its
job.  That space needs to come from somewhere.  I chose the stack
since the stack is readily at hand.  Other options include
malloc(), with a performance penalty, or alloca(), which does
not work right on many systems.

--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Reply via email to