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

------------------------------------------------------------------------------
BlackBerry&reg; 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

Reply via email to