On Apr 20, 2009, at 6:09 PM, D. Richard Hipp wrote:

>
> On Apr 20, 2009, at 5:32 PM, Jason Boehle wrote:
>
>> I have written an application for the iPhone called Grocery iQ that
>> uses SQLite.  I don't link to or use the built-in SQLite library on
>> the iPhone.  Instead, I compile the SQLite amalgamation into the
>> executable.  The SQLite version currently being used in our app is
>> 3.6.7.
>
> I sent instructions to Brian Killen on how you can download the latest
> version of SQLite+CEROD.  Perhaps recompiling will help.
>
>> * before opening the database, the only other SQLite API calls are:
>>       sqlite3_config(SQLITE_CONFIG_HEAP, &mSqliteMemory[0], 3145728,
>> 512); // mSqliteMemory is declared as: unsigned char
>> mSqliteMemory[3145728];
>
> You will probably do better to allocate most of that 3MB to page cache
> using sqlite3_config(SQLITE_CONFIG_PAGECHACHE, ...).  The assign 100K
> or so to each database connection's lookaside memory allocator using
> sqlite3_db_config(SQLITE_DBCONFIG_LOOKASIDE, ...) immediately after it
> is opened.  With the above, usually a 100K or so is enough heap,
> though more might be required if you are holding many prepared
> statements or if you are using unusually big prepared statements.
>
> Oops.  I'm late for meeting.  More to follow later tonight.....


As I was saying....

Use sqlite3_status() to actually measure your memory usage.  Make  
adjustments once you know how the memory is being used.  Don't guess;  
measure. Also remember that later versions of SQLite use less memory  
for storing prepared statements, so you might want to upgrade if  
memory is an issue.  Limit your cache sizes using the cache_size  
pragma.  Make use of sqlite3_soft_heap_limit() if you need to.  Or  
right a custom pcache implementation that limits the amount of memory  
used for the page cache.

D. Richard Hipp
d...@hwaci.com



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

Reply via email to