Hi all, We have an application with multiple databases of different page sizes. We keep a few long-running sessions, but also open transient sessions occasionally.
In an effort to reduce memory usage/fragmentation, we're trying to configure SQLite to allocate as much memory as necessary up-front (based on the excellent information in https://www.sqlite.org/malloc.html). Naively, I would expect SQLite to allocate a page cache per session. But reading the documentation, it sounds like there's only one page cache buffer, shared between all sessions. So if we want to use SQLITE_CONFIG_PAGECACHE to provide a preallocated buffer for the page cache, it looks like we have to provide it for the worst case, i.e. max(page size) * sum(cache requirements for all sessions). Is that the case? Moreover, if SQLITE_CONFIG_PAGECACHE is under-allocated, the docs say SQLite goes to malloc (or some variety thereof): > If SQLite needs a page-cache entry that is larger than "sz" bytes or if it > needs more than N entries, > it falls back to using the general-purpose memory allocator. https://www.sqlite.org/malloc.html#_page_cache_memory and: > If additional page cache memory is needed beyond what is provided by this > option, then > SQLite goes to sqlite3_malloc() for the additional storage space. https://www.sqlite.org/c3ref/c_config_getmalloc.html#sqliteconfigpagecache Does it do this for every page that doesn't fit, or just up-front to allocate a page cache block? That is, is SQLITE_CONFIG_PAGECACHE used to specify an arena for page caches, or a buffer for pages between all sessions? Since we have different page sizes (512 bytes and 4K respectively) I'm worried we'll have lots of dead space if SQLITE_CONFIG_PAGECACHE is set up for 4K pages and requests for 512-byte pages are served from there directly. Many thanks, - Kim _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users