SQLite Forum

SQLite error (7): failed to HeapReAlloc 465625658 bytes (8), heap=7A20000
I never found a real cause for these exceptions. I am trying to apply workaround for each and every one though. Maybe it is helpful for someone - things that can help:
- when inserting data, make sure it's sorted first (by ID column in my case)
- try to reduce number of queries (seems obvious, but not always is)
- when dealing with large column contents (like huge xml) try to retrieve the data row by row instead of an entire batch

I'm still amazed how many problems with memory dealing with virtual table brings here.

PS. I found out that most (or maybe even all) of the memory problems disappear when updating to FTS5.