I have tried a method to create a Mem and add a string to it, which is as below
sqlite3VdbeMemInit(&(p->custom_aMem[0]), p->db, MEM_Null); memAboutToChange(p,&(p->custom_aMem[0])); sqlite3VdbeMemSetStr(&(p->custom_aMem[0]), zColumn , strlen(zColumn)*sizeof(char), SQLITE_UTF8, SQLITE_STATIC); First I allocated space to Mem and initialized it using sqlite3VdbeMemInit( ) function. Then I changed the Mem and set the value of the string to the Mem using memAboutToChange( ) and sqlite3VdbeMemSetStr( ) respectively. Where zColumn is the string to be added. Is this the correct way to add data to Mem ??? Because when I add data using this method I experienced a memory leak when executing large number of queries. Can anyone kindly tell what is the correct way to add data to Mem ?