Memory leak
Submitted by Adrien SCH.
Assigned to mal..@..db.org
Link to original bug (#711290)
Description
I observed throw valgrind a memory leak with GdaConnection* object with the mysql provider.
This is the valgrind stack :
==7286== 13,440 bytes in 48 blocks are definitely lost in loss record 4,550 of 4,660 ==7286== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.s$ ==7286== by 0x6021AA0: g_malloc0 (gmem.c:189) ==7286== by 0xBA0A096: _gda_mysql_provider_meta_init (gda-mysql-meta.c:261) ==7286== by 0xBA09A43: _gda_mysql_reuseable_new_data (gda-mysql-reuseable.c:114) ==7286== by 0xBA04D8A: gda_mysql_provider_open_connection (gda-mysql-provider.c:704) ==7286== by 0x5A8604D: gda_connection_open (gda-connection.c:1705) ==7286== by 0x5A86650: gda_connection_open_from_string (gda-connection.c:1454) ==7286== by 0x66F0E02: ast_db_get_connection_without_parser (ast_db.c:1180) ==7286== by 0x971479A: ??? ==7286== by 0x971554C: ??? ==7286== by 0x603D9B4: g_thread_proxy (gthread.c:801) ==7286== by 0x64D5E99: start_thread (pthread_create.c:308)
==6656== 54,696 bytes in 43 blocks are definitely lost in loss record 4,724 of 4,759 ==6656== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.s$ ==6656== by 0x6021AA0: g_malloc0 (gmem.c:189) ==6656== by 0xBC895ED: real_open_connection (gda-mysql-provider.c:512) ==6656== by 0xBC8BCAF: gda_mysql_provider_open_connection (gda-mysql-provider.c:627) ==6656== by 0x5A8604D: gda_connection_open (gda-connection.c:1705) ==6656== by 0x5A86650: gda_connection_open_from_string (gda-connection.c:1454) ==6656== by 0x66F0E02: ast_db_get_connection_without_parser (ast_db.c:1203) ==6656== by 0x9B1479A: ??? ==6656== by 0x9B1555C: ??? ==6656== by 0x603D9B4: g_thread_proxy (gthread.c:801) ==6656== by 0x64D5E99: start_thread (pthread_create.c:308) ==6656== by 0x51393FC: clone (clone.S:112)
This is a part of my code : void ast_db_get_connection_without_parser() { GError* error= NULL; GdaConnection* result = NULL; result = gda_connection_open_from_string("MySQL", "DB_NAME=ast", "blabla",GDA_CONNECTION_OPTIONS_NONE,&error); if (result != NULL) { gda_connection_close(result); g_object_unref(result); } else { g_critical("Ast:DB Failed to connect to the database. Error : %s", ast_error_get_error_message(error)); if (error != NULL) g_error_free(error); } }
Uname : #47~precise1-Ubuntu SMP Wed Oct 2 16:19:35 UTC 2013
Package info :
Package: libgda-5.0-4 Status: install ok installed Priority: optional Section: libs Installed-Size: 1844 Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com Architecture: amd64 Source: libgda5 Version: 5.0.3-1 Depends: libgda-5.0-common (>= 5.0.3-1), libc6 (>= 2.14), libglib2.0-0 (>= 2.31.2), libsoup2.4-1 (>= 2.4.1), libxml2 (>= 2.7.4), libxslt1.1 (>= 1.1.25) Suggests: libgda-5.0-bin, libgda-5.0-mysql, libgda-5.0-postgres Description: data abstraction library based on GLib libgda is a (relatively small) database abstraction/access library integrated on the GLib object model. It can be used as a metadata extractor, to get information about all database objects in a common way, and as an ODBC-like wrapper to access data in different engines through an easier API. Original-Maintainer: Debian GNOME Maintainers pkg-gnome-maintainers@lists.alioth.debian.org Homepage: http://www.gnome-db.org/
Version: 5.0.x