Based on your comments and the mmap error, I think you are having a similar problem to one I am still struggling with - over use of unified buffer cache. What I'm guessing is going on here is that sqlite is using a mmap file to backup its "in memory" database. So its mmap'd memory, which uses the unified buffer cache (i.e. the shared memory pool), and probably does not use much malloc'd memory at all (which is why you don't see big numbers there).
Now, as the ubc cache becomes increasingly "dirty", iOS starts getting deprived of memory it can use at any instance. So, at some time, sqlite tries to mmap more memory, but when the system looks for free ubc pages, there aren't any free ones. It takes a LONG time to flush blocks to a flash file system.
What makes this such an onerous problem is there is little you can do in your app to even discover that memory is getting low, so you can take steps to avoid it.
What I did in my "display huge downloaded images" open source project is sep track of my ubc usage, and never let it get above 50% of the total system memory.
In your case you may find it better to have sqlite to be file based, then save and F_FULLSYNC the file (waiting for completion) before proceeding. In the end I funneled all my image work through a serial dispatch queue that keep account of the high water mark.