Hi all,
I wrote a simple app that is use sqlite 3.8.2 as below:
//============================================================================
// Name : test.cpp
// Author : Ali
// Version :
// Copyright : GPLv3
// Description : Sqlite Test
// SQLITE Version : 3.8.2
//============================================================================
#include <stdlib.h>
#include <stdio.h>
#include "sqlite3.h"
#define ERROR -1
#define MY_DB "test.db"
int myCallBackFunction(void* notUsed, int columnNo, char **argv,
char **azcolName)
{
static bool flag = true;
if (flag)
{
printf("%s %s %s\n", azcolName[0], azcolName[1],
azcolName[2]);
printf("--------------------------------------------------------\n");
flag = false;
}
{
printf("%s %s %s$\n", argv[0], argv[1], argv[2]);
}
return 0;
}
int main()
{
sqlite3 *dbConnection;
char *sqlite_errMsg;
int result = ERROR;
result = sqlite3_open(MY_DB, &dbConnection);
if (result != SQLITE_OK)
{
printf("Error on SQLITE\n");
sqlite3_close(dbConnection);
return ERROR;
}
printf("%s DB Was successfully created!\n", MY_DB);
char *sqlCommand =
"DROP TABLE IF EXISTS Cars;"
"CREATE TABLE Cars(Id INT, Name TEXT, Price INT);"
"INSERT INTO Cars VALUES(1, 'Audi', 52642);"
"INSERT INTO Cars VALUES(2, 'Mercedes', 57127);"
"INSERT INTO Cars VALUES(3, 'Skoda', 9000);"
"INSERT INTO Cars VALUES(4, 'Volvo', 29000);"
"INSERT INTO Cars VALUES(5, 'Bentley', 350000);"
"INSERT INTO Cars VALUES(6, 'Citroen', 21000);"
"INSERT INTO Cars VALUES(7, 'Hummer', 41400);"
"INSERT INTO Cars VALUES(8, 'Volkswagen', 21600);";
result = sqlite3_exec(dbConnection, sqlCommand, 0, 0, &sqlite_errMsg);
if (result != SQLITE_OK)
{
printf("SQL error: %s\n", sqlite_errMsg);
sqlite3_free(sqlite_errMsg);
sqlite3_close(dbConnection);
return ERROR;
}
sqlite3_stmt *stmt;
char *sqlSelect = "SELECT * FROM Cars";
result =
sqlite3_exec(dbConnection,sqlSelect,myCallBackFunction,0,&sqlite_errMsg);
if (result != SQLITE_OK )
{
printf("Failed to select data\n");
printf("SQL error: %s\n", sqlite_errMsg);
sqlite3_free(sqlite_errMsg);
sqlite3_close(dbConnection);
return ERROR;
}
sqlite3_close(dbConnection);
return 0;
}
When I use Massif as a heap profiler the diagram shows non freed memory but
without Sqlite the diagram starts with 0 byte and end in 0 byte?
Yours,
Ali
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users