System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 2f80d0bbec4a31da904cb9122f284e2abb1f5804
Title: Memory not released when using in-memory DB
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Resource_Cleanup Resolution: Unable_To_Reproduce
Last Modified: 2013-06-25 23:49:43
Version Found In: 1.0.86.0
User Comments:
anonymous added on 2013-06-18 08:41:14: (text/x-fossil-plain)
I am loading a file into a in-mem DB using SQLiteConnection.BackupDatabase().  Subsequent to querying the DB, and other operations, I close the connection.  But the memory allocated for the DB is not released, and I see OutOfMemoryException in other parts of my code. Essentially the memory allocated is blocked forever.  Here is the code snippet.

// Open In memory DB Connection
public void OpenInMemDBConnection() {
    SQLiteConnection inMemDBConnection = new SQLiteConnection("Data Source=:memory:;Version=3;Journal Mode=Off;Synchronous=Off;New=True;");
    inMemDBConnection.Open();

    // loading from the created oatdb.db,Source database connection.
    SQLiteConnection fileDBConnection = new SQLiteConnection("Data Source=test.db;");

    // open the source database conneciton
    fileDBConnection.Open();

    // back up to the inmemorydatabase , main is indicate the database used is the main database. In case of temporary 
    // database, it would be "temp".
    fileDBConnection.BackupDatabase(inMemDBConnection, "main", "main", -1, null, 0);
    
    // close the source.
    fileDBConnection.Close();
    fileDBConnection.Dispose();
    fileDBConnection = null;
}
        
// Close In Memory DB Connection
public void CloseInMemDBConnection() {
    inMemDBConnection.Close();
    inMemDBConnection.Dispose();
    inMemDBConnection = null;
}

This is consistently reproducible on a Windows CE 5.0 , Windows Mobile 6.0 device.

Hope this details suffice. Any insight into this issue either a fix or as a known issue would be greatly appreciated.

Thanks & Regards,
pG

mistachkin added on 2013-06-25 22:55:21: (text/x-fossil-plain)
Can this issue be reproduced with the desktop version of the .NET Framework?