I think you are assuming that the problem you are having is in SQLite. And, who knows, that could yet prove to be the case. But historically, when problems like this have come up, and especially problems with memory allocation, the error has almost always been heap corruption caused by other unrelated modules of the application that SQLite just happen to have the misfortune of tripping over.