[freetds] Memory leaks in sql calls

Song, Cavin csong at Securify.com
Wed Oct 3 15:40:24 EDT 2007


Hi,

I'm new to this list and I have a question regarding memory leaks with
the sql query call to executeUpdate().

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 and then sleep for 5
minutes so you have time to see the run-time size of mysql using 'top'
cmd. The leak size is about 20 MB which is what I origially saw in an
older version of odbc++ and unixodbc libs. I'm running this on linux
with a Sybase database and the driver is freetds ('dmtest' program shows
the following):

Available datasources:
        local (FreeTDS)
Available drivers:
        FreeTDS
                Attribute: Description=FreeTDS
                Attribute: Driver=/usr/local/lib/libtdsodbc.so.0
                Attribute: Setup=/usr/local/lib/libtdsS.so.1
                Attribute: FileUsage=1
                Attribute: CPTimeout=
                Attribute: CPReuse=

Does anyone experience the same problem? The leak may come from either
odbc++, unixodbc or freetds and I have posted the same question to
odbc++ and unixodbc discussion forums, but have not gotten any firm
answer regarding the source of the leak. Thanks you for your help.

Cavin Song



More information about the FreeTDS mailing list