[unixODBC-support] Memory leaks in sql calls

Nick Gorham nick.gorham at easysoft.com
Wed Oct 3 09:18:55 BST 2007

Song, Cavin wrote:

>Hi Nick,
>Thanks for the quick reply. Yesterday I compiled and installed the
>latest odbc++ and unixodbc packages on my linux box:
>  libodbc++-0.2.4pre3
>  unixODBC-2.2.11
>Then modified libodbc++-0.2.4pre3/tests/mysql.cpp to call the existing
>dropTables() function in mysql.cpp 6500 times and the leak is about 20
>MB. Here is what I did to mysql.cpp:
>In main(), change the 1st dropTable() call to:
>  for (int i=0; i<6500; i++)
>    dropTables(con.get());
>  sleep(300);
>In other words, call dropTables() 6500 times (because dropTables() calls
>dropTable() twice) and then sleep for 5 minutes so you have time to run
>another cmd session to see the run-time size of mysql. The leak size is
>pretty much consistent with what I found using the older odbc libs. I'm
>not 100% sure but I think you should be able to reporduce the problem on
>your machine.
What driver are you using again?

Did you try using valgrind to see where the leak is happening?

Have you tried a different driver to see if the problem happens in the 

Nick Gorham
Easysoft Limited
http://www.easysoft.com, http://www.unixODBC.org

More information about the unixODBC-support mailing list