[unixODBC-support] Memory leaks in sql calls

Song, Cavin csong at Securify.com
Tue Oct 2 18:51:14 BST 2007

Hi Nick,

Thanks for the quick reply. Yesterday I compiled and installed the
latest odbc++ and unixodbc packages on my linux box:


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++)

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.


> -----Original Message-----
> From: unixodbc-support-bounces at easysoft.com 
> [mailto:unixodbc-support-bounces at easysoft.com] On Behalf Of 
> Nick Gorham
> Sent: Tuesday, October 02, 2007 10:23 AM
> To: Support for the unixODBC project
> Subject: Re: [unixODBC-support] Memory leaks in sql calls
> Song, Cavin wrote:
> >
> >I'm using an old version of unixobdc and odbc++ and I'm wondering if 
> >the leak problem(s) has been fixed in the lastest verison of 
> unixobdc 
> >and
> >odbc++. The database is Sybase and the 'dmtest' program (not sure if
> >this helps) shows:
> >
> >  
> >
> Hi,
> well I can only speak for unixODBC, AFAIK, there are no leaks 
> of this sort in the driver manager now, there may have been 
> in the past, but I don;t think so. Most leaks that may have 
> been there are around reusing connections, not just running queries.
> Try using valgrind to see where the leaks are allocated.
> --
> Nick Gorham
> Easysoft Limited
> http://www.easysoft.com, http://www.unixODBC.org
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-support

More information about the unixODBC-support mailing list