The following code uses Qt SQL version 4.9 with sqlite.
#include <QtSql>
int main(int argc, const char **argv) {
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("db.sqlite");
db.open();
QSqlQuery query;
query.exec("CREATE TABLE test (test VARCHAR PRIMARY KEY);");
db.close();
}
Valgrind gives me a leak report like this:
==2832== LEAK SUMMARY:
==2832== definitely lost: 168 bytes in 3 blocks
==2832== indirectly lost: 556 bytes in 9 blocks
==2832== possibly lost: 0 bytes in 0 blocks
==2832== still reachable: 51,660 bytes in 83 blocks
That is just a simple SQL query and I do not understand why there are so much leaks. These leaks are located in QLibrary and QFactoryLoader. Is there any way to clean the memory on application exit?