We rely on the SQLite memory management to enforce the memory usage in our application (running on Windows CE). This has worked quite well for us, but have found that when we hit the limit, in some circumstances, performance drops significantly.
Looking into the internals of SQLite, it seems that when you are at the memory limit, an allocation of size N will attempt to free N bytes from the pager. We think this should be increased for performance reasons. By altering softHeapLimitEnforcer to free more than is necessary, the limit isn't reached again (or at least for some time) which helps in our tests, though we haven't done a formal benchmark. Adding these lines to the softHeapLimitEnforcer seem to help: if (allocSize < inUse/8) { allocSize += inUse/8; } Here, the function's being called with an allocSize equal to the page size of the database, and inUse is at the soft heap limit. Instead of freeing a page (and then being called over and over, essentially), we free 12% of the memory in use. If a formal benchmark should be done, this would be the figure to tweak -- 12% gives much improved performance in our tests (when the heap limit is roughly 1000 pages in size). -- View this message in context: http://www.nabble.com/Soft-heap-limit-enforcement-performance-tf4718320.html#a13488090 Sent from the SQLite mailing list archive at Nabble.com. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------