View Ticket
Not logged in
Ticket UUID: 05de3760cb48f157d11131650382541beeb05bf4
Title: Memory Leak in both Mixed Mode and Interop version
Status: Closed Type: Incident
Severity: Important Priority: Blocker
Subsystem: Integration_Via_PInvoke Resolution: Unable_To_Reproduce
Last Modified: 2013-03-26 18:48:10
Version Found In:
User Comments:
anonymous added on 2013-03-22 21:08:33:
I am getting debilitating memory leaks with the current version of SQLite .Net. I tried using both the interop (preferred solution) and the mixed mode assembly as a test. Both had issues. 

The current SQLite dll that we have in operation is which has performed flawlessly however we are looking to move to the interop version, so we are getting the latest.

In a particular test of our process we are reading about 30 megs of data from a sqlite database and then creating about a 20-30 meg sqlite database. By the time that we get to around 10 megs written, the process either crashes in x86 (over 1.6 gigs of memory used) or we are already up in the 5 gig of memory territory used in x64. The same situation with the should only take up about 100-200 megs for the entire process. Unfortunately I don't have the interop for that version to try that to see if its usable.

When i first got the latest release version I was (behind the scenes) receiving SQLite Error #21 pretty constantly. (I would guesstimate, every single read/write). I eventually made sure to clear everything and put together the bin directory as recommended with the auto loading (that solution is the one I am desiring) and I am not seeing those same error behind the scenes, but the memory leak remains.

All read and writes are done using the regular ADO classes and I'm not doing anything particularly fancy. I wish i could give more diagnostics, but there is definitely something in at least that is causing this memory leak.


mistachkin added on 2013-03-22 21:29:28:
Could you provide some example C# code that demonstrates the memory leak?  The
test suite for System.Data.SQLite has a wide variety of tests, including stress
tests, and none of them show memory leaks.

Also, there was a big change in how IDisposable objects are handled as of version  All System.Data.SQLite objects that implement IDisposable must be
disposed before the memory used by the associated connection can be reclaimed.
This mostly applies to the SQLiteCommand and SQLiteDataReader objects.

anonymous added on 2013-03-25 12:19:05:
Let me double check that my code is calling all of the IDisposables. I would be very surprised if it does not.

I'll run a couple of tests, or isolate the specific database code and get back with you.

Thanks for the response.