Markus Hoenicka writes:
 > mimo writes:
 > I've tried to reproduce this problem on my FreeBSD box, to no avail
 > yet. First of all, being a C programmer I failed to compile your test
 > successfully. Could you please post the magic gcc incantation which
 > will compile the program? Second, FreeBSD 7.2 seems to have problems
 > unloading the drivers while runing under gdb. I needed to check the
 > program in gdb as valgrind would cause the program to dump core. In
 > any case, even switching off the code which would unload the driver
 > when shutting down the library wouldn't make valgrind happy. A quick
 > search on the web confirmed that valgrind is not fully operational on
 > FreeBSD currently. I'll try again tomorrow on a Debian box.
 > 

FreeBSD now has an updated valgrind which seems to work ok. I've
managed to reproduce the problem reported by mimo. I'm using the
current cvs revisions of both libdbi and libdbi-drivers, so there may
be some (unintentional) improvements regarding this issue. The mysql driver
causes some memory to be lost:

==3850== LEAK SUMMARY:
==3850==    definitely lost: 16 bytes in 1 blocks
==3850==    indirectly lost: 0 bytes in 0 blocks
==3850==      possibly lost: 32,704 bytes in 8 blocks
==3850==    still reachable: 3,942 bytes in 12 blocks
==3850==         suppressed: 0 bytes in 0 blocks

The same does not happen with sqlite3:

==3842== LEAK SUMMARY:
==3842==    definitely lost: 0 bytes in 0 blocks
==3842==    indirectly lost: 0 bytes in 0 blocks
==3842==      possibly lost: 0 bytes in 0 blocks
==3842==    still reachable: 652 bytes in 7 blocks
==3842==         suppressed: 0 bytes in 0 blocks

so I assumed this is a driver problem. I went back to the driver
sources and to the MySQL manual. Actually the driver did not call a
cleanup function after terminating the connection. Calling
mysql_server_end() is recommended to free any remaining memory. After
adding this call to an appropriate function of the mysql driver, I
wind up losing no memory:

==4240== LEAK SUMMARY:
==4240==    definitely lost: 0 bytes in 0 blocks
==4240==    indirectly lost: 0 bytes in 0 blocks
==4240==      possibly lost: 0 bytes in 0 blocks
==4240==    still reachable: 3,942 bytes in 12 blocks
==4240==         suppressed: 0 bytes in 0 blocks

If you have a chance to test the current sources on your platform,
please let me know if your leaks are cured as well.

regards,
Markus

-- 
Markus Hoenicka
http://www.mhoenicka.de
AQ score 38

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
libdbi-devel mailing list
libdbi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-devel

Reply via email to