Re: [sqlite] Stack allocation upper bound with SQLITE_USE_ALLOCA

2019-04-03 Thread Jonathan Brandmeyer
On Wed, Apr 3, 2019 at 8:55 AM Richard Hipp  wrote:
>
> On 4/3/19, Jonathan Brandmeyer  wrote:
> > What is the upper bound for stack consumption under the
> > SQLITE_USE_ALLOCA compile-time option?  I see that there are a number
> > of configurable size limits available as compile-time and/or run-time
> > options.  Which ones affect the maximum alloca?
> >
>
> I think the maximum alloca() allocation will be 7x the page size for
> the database file.  So a little less than 0.5 MB assuming a maximum
> page size of 64K.

Thanks!

-- 
Jonathan Brandmeyer
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Stack allocation upper bound with SQLITE_USE_ALLOCA

2019-04-03 Thread Dominique Pellé
Jonathan Brandmeyer  wrote:

> What is the upper bound for stack consumption under the
> SQLITE_USE_ALLOCA compile-time option?  I see that there are a number
> of configurable size limits available as compile-time and/or run-time
> options.  Which ones affect the maximum alloca?
>
> Thanks,
> Jonathan Brandmeyer

I recall using this tool to measure stack usage on Linux:

  https://github.com/d99kris/stackusage

It gives you the stack high watermarks for each thread,
with no noticeable runtime overhead.

Of course, there is no guarantee that you hit the theoritical
worse case for stack usage while using the tool, but at least you
get at least the typical stack usage.

You could try measuring with and without -DSQLITE_USE_ALLOCA.

Other relevant defines that may influence stack usage:

SQLITE_SPELLFIX_STACKALLOC_SZ
SQLITE_SMALL_STACK

Dominique
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Stack allocation upper bound with SQLITE_USE_ALLOCA

2019-04-03 Thread Richard Hipp
On 4/3/19, Jonathan Brandmeyer  wrote:
> What is the upper bound for stack consumption under the
> SQLITE_USE_ALLOCA compile-time option?  I see that there are a number
> of configurable size limits available as compile-time and/or run-time
> options.  Which ones affect the maximum alloca?
>

I think the maximum alloca() allocation will be 7x the page size for
the database file.  So a little less than 0.5 MB assuming a maximum
page size of 64K.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users