i use sqlite3_prepare_v2 within c++ application and get memory leaks, when instantiate a sqlite3_stmt outside function which is calling sqlite3_prepare_v2.
sample:
sqlite3_stmt* ps=NULL;
void prepare(void)
{
if(ps == NULL)
sqlite3_prepare_v2(&db,"insert into nomatterbd...",-1,&ps,NULL);
}
call prepare, close application and you get memory leaks.
Doing this way:
void prepare(void)
{
sqlite3_stmt* ps=NULL;
sqlite3_prepare_v2(&db,"insert into nomatterbd...",-1,&ps,NULL);
}
no memory leaks. checked with latest amalgation.
My goal is to open and close a DB on each insert or update. To speed up the whole thing, i'd like to prepare global statements for insert and update. Unfortunately, this will fail, if global and once created statements cause mem leaks.
Can anyone help ? Thank you.