I'm facing a problem when inserting rows into a newly created database.
In the failing process a conversion from Oracle to SQLite is made. Looping through around 260k of Oracle rows, sqlite throws an exception on insert, close to the 260k mark:
SQLite error (7): failed to HeapReAlloc 465625658 bytes (8), heap=7A20000
Exception thrown: 'System.Data.SQLite.SQLiteException' in System.Data.SQLite.dll
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
The process stopped working when a change was introduced to the target sqlite table: the table is now virtual and uses the FTS v4 module.
Some more details:
- code is written in C#, using System.Data.SQLite.Core nuget package (latest - 188.8.131.52 was tested as well)
- entire process is wrapped in a transaction
- one of the source column is an XML containing Thai script strings
What I've tried:
- splitting the process into smaller transactions (10k, 1k)
- disposing and creating a new SQLiteCommand and SQLiteConnection per transaction
- running SQLiteConnection.ReleaseMemory()
- closing and openning a new connection to sqlite db with each new transaction start (also running SQLiteConnection.Shutdown())
I'm really running out of ideas here. Any help is appreciated.