Stack allocation upper bound with SQLITE_USE_ALLOCA

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Stack allocation upper bound with SQLITE_USE_ALLOCA

Jonathan Brandmeyer
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
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Stack allocation upper bound with SQLITE_USE_ALLOCA

Richard Hipp-3
On 4/3/19, Jonathan Brandmeyer <[hidden email]> 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
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Stack allocation upper bound with SQLITE_USE_ALLOCA

Dominique Pellé
In reply to this post by Jonathan Brandmeyer
Jonathan Brandmeyer <[hidden email]> 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
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Stack allocation upper bound with SQLITE_USE_ALLOCA

Jonathan Brandmeyer
In reply to this post by Richard Hipp-3
On Wed, Apr 3, 2019 at 8:55 AM Richard Hipp <[hidden email]> wrote:

>
> On 4/3/19, Jonathan Brandmeyer <[hidden email]> 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
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users