Our vendor provided a custom C compiler which is overflowing the stack with the 
increased depth of the call table which then overflows into other memory.  

Andrew Beal

Office: 508-289-2970
Email: ab...@whoi.edu

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Tuesday, July 30, 2013 9:38 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Minimizing Internal Function Calls in SQLite

On Tue, Jul 30, 2013 at 9:30 AM, Andrew Beal <ab...@whoi.edu> wrote:

> Richard,
>
> Thanks for the response. We are using a custom environment without a 
> deep call stack due to specific hardware latency issues.


Do you have a custom C compiler?  Or is there some extant C compiler (that I 
don't know about) that limits the call stack depth?


> How does the SQLITE_SMALL_STACK option work with the 
> SQLITE_ZERO_MALLOC option?
>

SQLITE_SMALL_STACK simply causes SQLite to malloc() for certain largish 
variables rather than declare them as "automatic" stack variables.

"malloc()" in the previous sentence means the internal sqlite3_malloc() 
routines.  When SQLITE_ZERO_MALLOC is used, sqlite3_malloc() looks to its 
assigned static buffer to fulfill memory allocation requests rather than going 
to system malloc().  If you use the mem5 memory allocator, and if you limit the 
maximum size of memory allocations and if you never use to much memory at one 
time, this guarantees that sqlite3_malloc() will never fail due to memory 
fragmentation, which is an important property for some embedded systems.

So SQLITE_ZERO_MALLOC means "no cause to the system malloc()" library and no 
memory allocation from heap.  The internal sqlite3_malloc() routine is still 
called quite frequently.

SQLITE_ZERO_MALLOC and SQLITE_SMALL_STACK are compatible options.


>
> F. Andrew Beal
>
> Woods Hole Oceanographic Institution
> 266 Woods Hole Road MS#18
> Woods Hole, MA 02543
>
> Office: 508-289-2970
> Email: ab...@whoi.edu<mailto:ab...@whoi.edu>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to