[libdbi-users] Memory leak when using dbi_initialize in loop
Hi, Using libdbi on Fedora 14: libdbi-dbd-sqlite-0.8.3-6.fc14.i686 libdbi-devel-0.8.3-4.fc14.i686 libdbi-0.8.3-4.fc14.i686 libdbi-drivers-0.8.3-6.fc14.i686 libdbi-dbd-mysql-0.8.3-6.fc14.i686 The following code continues to allocate memory, but, doesn't deallocate it. Can you please let me know what is wrong? === CODE === #include stdio.h #include dbi/dbi.h int main() { dbi_conn conn; while (1) { dbi_initialize(NULL); conn = dbi_conn_new(mysql); dbi_conn_set_option(conn, host, localhost); dbi_conn_set_option(conn, username, foo); dbi_conn_set_option(conn, password, bar); dbi_conn_set_option(conn, dbname, test); dbi_conn_set_option(conn, encoding, UTF-8); if (dbi_conn_connect(conn) 0) { printf(Could not connect. Please check the option settings\n); } else { /* Do something, and delay */ dbi_conn_close(conn); } dbi_shutdown(); } return 0; } === END === I am trying to do a task after the database connect, give a delay and loop around, but the above flow is leaking memory. Appreciate any inputs in this regard! SK -- Shakthi Kannan http://www.shakthimaan.com -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos much more. Register early save! http://p.sf.net/sfu/rim-blackberry-1 ___ libdbi-users mailing list libdbi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-users
Re: [libdbi-users] Memory leak when using dbi_initialize in loop
Hi Markus, I came across this memory leak post: http://comments.gmane.org/gmane.comp.db.libdbi.devel/309 Is this fixed in the sources and am I using old version of the software? libdbi-devel-0.8.3-4.fc14.i686 libdbi-0.8.3-4.fc14.i686 libdbi-drivers-0.8.3-6.fc14.i686 libdbi-dbd-mysql-0.8.3-6.fc14.i686 SK -- Shakthi Kannan http://www.shakthimaan.com -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos much more. Register early save! http://p.sf.net/sfu/rim-blackberry-1 ___ libdbi-users mailing list libdbi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-users
Re: [libdbi-users] Memory leak when using dbi_initialize in loop
Hi Markus: --- On Tue, Aug 9, 2011 at 4:51 PM, markus.hoeni...@mhoenicka.de wrote: | I've reproduced the leak that you detected in the current cvs | sources. According to my analysis the drivers pass error messages | through dbd_geterror() as allocated | strings. _dbd_internal_error_handler() created another copy with | strdup() which isn't necessary. The latter copy was freed, the | original copy was left in place. I've fixed this leak in the current | cvs revision. \-- Which is the current cvs revision, and which file is it? I am not able to see any commit logs at: http://sourceforge.net/mailarchive/forum.php?forum=libdbi-cvs Thanks for your prompt response. SK -- Shakthi Kannan http://www.shakthimaan.com -- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ libdbi-users mailing list libdbi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-users