Hello, I'm a bit new to sqlite, I wonder if someone can advise me here. I'm using the Sqlite C/C++ interfaces, and I'm trying to do some very basic things. Currently I'm just creating a database with 1 table, and this table has 1 column of type blob. I then read some data out of a file and insert it into the database, where each row will contain some number N of bytes from the file, where N may not necessarily be the same in each row.
I'm doing this using the following pseudocode: ---Initialization--- 1) db = sqlite3_open_v2("C:\\foo.db") 2) sqlite3_exec(db, "CREATE TABLE DummyTable (DummyColumn BLOB)") 3) insert_query = sqlite3_prepare_v2(db, "INSERT INTO DummyTable (DummyColumn) VALUES (?1)") 4) commit_query = sqlite3_prepare_v2(db, "commit") 5) begin_query = sqlite3_prepare_v2(db, "begin") ---When I want to write a chunk of the file into the database--- if (!active_transaction_) { //begin a new transaction sqlite3_step(begin_query) active_transaction_ = true; } //bind the data to the query and execute the query sqlite3_bind_blob(insert_query, data, length) sqlite3_step(insert_query) // * sqlite3_clear_bindings(insert_query) // * sqlite3_reset(insert_query) // * //128 is a made up number, just for the sake of illustration if (++count >= 128) { //commit the transaction sqlite3_step(commit_query) active_transaction_ = false; } When I run this code for a while my memory usage grows extremely quickly, and I don't understand why. If I remove or comment out the three lines with //* in the code above, I get no memory leaks. If it makes a difference when I call sqlite3_bind_blob I'm using SQLITE_TRANSIENT for the final parameter, but my understanding is that this is supposed to automatically free the memory when it's no longer needed. Furthermore, the bind itself isn't what's causing the problem, because if I leave the bind in and only comment out the insert, I don't get the leak anymore. Am I using the interfaces incorrectly or is perhaps something else going on that I need to be aware of? Thanks _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users