Ticket Hash: | 3b9dcdc32d08baf3859c8f216b8e90861f9c2e82 | |||
Title: | throw outofmemory exception when using zeroblob | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Important | Priority: | High | |
Subsystem: | Resource_Cleanup | Resolution: | Unable_To_Reproduce | |
Last Modified: | 2012-01-21 04:36:06 | |||
Version Found In: | 1.0.65 | |||
Description: | ||||
This issue can be reproduced by the following code in WM6.5
string _connectionString = @"Data Source=db1.db"; string _sql; SQLiteConnection conn = new SQLiteConnection(); SQLiteCommand cmd; conn.ConnectionString = _connectionString; conn.Open(); // _sql = "drop table tb"; // cmd = new SQLiteCommand(_sql, conn); // cmd.ExecuteNonQuery(); // cmd.Dispose(); _sql = "create table tb( ID integer, content blob null, content2 blob null)"; cmd = new SQLiteCommand(_sql, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); _sql = "insert into tb( ID) values( 10)"; cmd = new SQLiteCommand(_sql, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); _sql = "update tb set content = zeroblob(10*1024*1024) where rowid = 1"; cmd = new SQLiteCommand(_sql, conn); cmd.ExecuteNonQuery(); cmd.Dispose(); _sql = "update tb set content2 = zeroblob(10) where rowid = 1"; cmd = new SQLiteCommand(_sql, conn); cmd.ExecuteNonQuery(); //throw outofmemory exception cmd.Dispose(); mistachkin added on 2011-11-22 22:57:44 UTC: mistachkin added on 2011-11-27 12:12:39 UTC: mistachkin added on 2011-11-28 04:08:10 UTC: After using a command, it should be explicitly disposed (i.e. not simply left to be collected by the GC). Simply letting it be collected by the GC will not release the memory it references in a timely fashion. Also, repeating creating and using commands without explicitly disposing them could cause an out-of-memory condition to occur. mistachkin added on 2011-12-16 05:05:24 UTC: |