> Is there any sqlite function I can call, or some other technique, to reduce
> the memory allocated and hung-onto by sqlite, particularly during a VACUUM?

Yes, execute "pragma cache_size = 100" for example, or put other
number of your liking into there.

If closing and re-opening of the database makes extra memory usage to
go away then it was used by database cache. Default cache size is 2000
pages. Command shown above sets it to 100 pages. I don't know what
size of cache is best for you, just beware that usually with smaller
cache SQLite needs more frequently to go to disk and thus queries are
slower. But cache works only if you repeatedly access the same
tables/indexes over the same connection. And I don't know how much
slower queries are without cache on iOS.


Pavel

On Wed, Mar 9, 2011 at 10:23 AM, Nick Hodapp <nicholashod...@gmail.com> wrote:
> I'm using sqlite in an iOS app, via the popular FMDB wrapper.
>
> My profiling tool is showing me that the app is using 2.5 MB of memory
> before a VACUUM, and nearly 6MB after.  The tool shows that the extra memory
> was allocated by sqlite3MemMalloc().  If I close and re-open the database
> then the extra memory usage goes away, returning to 2.5 MB.
>
> Is there any sqlite function I can call, or some other technique, to reduce
> the memory allocated and hung-onto by sqlite, particularly during a VACUUM?
>
> It's possible but unlikely that the FMDB wrapper is affecting things.  I
> haven't removed it from the equation to test, however.
>
> Nick Hodap
> _______________________________________________
> 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