Hi.
I'm using SQLite for the first time and our project performs hundreds of
insert/delete operations continuously. Analysing the process with
Valgrind, we got the following report, which shows a growing of memory
allocated along the time.
==28046== 91994 bytes in 674 blocks are still reachable in loss record
37 of 37
==28046== at 0x4001368E: malloc (vg_replace_malloc.c:153)
==28046== by 0x4035173A: sqliteMalloc (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40335616: sqliteStartTable (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40347107: yy_reduce (parse.y:91)
==28046== by 0x403488C7: sqliteParser (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40350416: sqliteRunParser (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x4034240C: sqlite_compile (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40342139: sqlite_exec (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40341387: sqliteInitCallback (../sqlite/src/main.c:86)
==28046== by 0x4034167C: sqliteInitOne (../sqlite/src/main.c:248)
==28046== by 0x40341B68: sqliteInit (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40342327: sqlite_compile (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x40342139: sqlite_exec (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x4034F90F: sqlite_get_table (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x4034B3CC: sqlite_get_table_vprintf (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x4034B38E: sqlite_get_table_printf (in
/axs/bin/ectrust/lib/libsqlite.so.0.8.6)
==28046== by 0x8056DB5: remove_chamada_bd_virtual
(monitor_ambiente.c:517)
The code is shown below:
517 i = sqlite_get_table_printf(dbEventos, strSQL, &resultdb, &rows,
518 &cols, &strErroDB);
519
520 if (strErroDB) {
521 trace("MA-ERRO: '%s'", strErroDB);
522 sqlite_freemem(strErroDB);
523 }
524
525 sqlite_free_table(resultdb);
We are using SQLite version 2.8.15.
Is there a way to deallocate these blocks of memory ? Any Problems with
the code ?
Thanks,
Gerson Vaz