Well your test code has no leak with the free added -- so you need to post
better test code to demonstrate your leak.
Otherwise the suspicion would be with YOUR code.
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
From:
Below is my code. My question is:
Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively, the sqlite3_prepare_v2() of
pthread2 still prepares the p_stmt pointer to a piece of memory malloced by
sqlite3_preapare_v2(). And then the sqlite3_finalize() can't free the
Is there any memory leak in the code?
Below is the code. Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively, the sqlite3_prepare_v2() of
pthread2 still prepares the p_stmt pointer to a piece of memory malloced by
sqlite3_preapare_v2(). And then the
Is there any memory leak in the code?
Below is the code. Is there any memory leak in the pthread2?
While pthread1 is using test.db exclusively, the sqlite3_prepare_v2() of
pthread2 still prepares the p_stmt pointer to a piece of memory malloced by
sqlite3_preapare_v2(). And then the
it is not necessary to send your question multible times... ;)
to answer: what makes you think that sqlite3_finalize can't
free the prepared statement ?
liubin liu wrote:
Is there any memory leak in the code?
Below is the code. Is there any memory leak in the pthread2?
While pthread1 is
On Apr 23, 2010, at 2:34 PM, liubin liu wrote:
Is there any memory leak in the code?
The buffers returned by sqlite3_mprintf().
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
sorry for multi-send the message.
I just test the code again. And sqlite3_finalize() may free the memory. I'm
wrong in the first post.
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,
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
You need to sqlite3_free(sql) after you use the sql from your sqlite3_mprintf().
sql = sqlite3_mprintf (sql_f, i);
ret = sqlite3_prepare_v2 (db1, sql, -1, p_stmt, NULL);
sqlite3_free(sql);
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
Thanks :)
But in my real code, the sqlite3_free(sql) is in the right place. So I think
that there are other reasons causing the leak.
Black, Michael (IS) wrote:
You need to sqlite3_free(sql) after you use the sql from your
sqlite3_mprintf().
sql = sqlite3_mprintf (sql_f,
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:
11 matches
Mail list logo