the code's test result in my first post is : pthread2: prepare: 0, p_stmt: 0xb6a00de0, errmsg: not an error pthread2: step: 5, p_stmt: 0xb6a00de0, errmsg: database is locked pthread2: finalize: 5, p_stmt: 0xb6a00de0, errmsg: database is locked pthread2: finalize: 21, p_stmt: 0xb6a00de0, errmsg: database is locked
... ... (same as upper, nine times) ... pthread2: close: 0, p_stmt: 0xb6a00dd0, errmsg: library routine called out of sequence _______________________________________________________ >From the result, could I suppose that the sqlite3_finalize()'s return code is wrong, and the memory pointed by p_stmt isn't freed by sqlite3_finalize()? Simon Slavin-3 wrote: > > > On 23 Apr 2010, at 1:16pm, liubin liu wrote: > >> But I test the routine of sqlite3_prepare_v2() + sqlite3_step() + >> sqlite3_finalize() in my real code. >> >> And the test result say when sqlite3_step() is shadowed, the leak is >> zero. >> When doing the sqlite3_step(), the leak is about 1k byte. And another >> curious phenomenon is that while there are many datas in the data file, >> the >> leak is more bigger than while there are few datas in the data file. > > It is okay for both sqlite3_prepare_v2() and sqlite3_step() to use memory, > but all the memory they use should be released by sqlite3_finalize(). So > ignore any information you get until you have correctly called the > _finalize() function. > > Similarly, opening a database may use up memory, but calling _close() > should free it all. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://old.nabble.com/Is-there-any-memory-leak-in-the-code-while-being-busy--tp28337646p28347933.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users