After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 777860 - Detected memory leaks
Detected memory leaks
Status: RESOLVED OBSOLETE
Product: libgda
Classification: Other
Component: general
unspecified
Other Linux
: Normal critical
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-28 02:40 UTC by silvioprog
Modified: 2018-09-21 13:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description silvioprog 2017-01-28 02:40:41 UTC
Hello masters,

I opened a topic talking about some leaks in libgda: https://mail.gnome.org/archives/gnome-db-list/2017-January/msg00007.html . A very basic test to generate leaks:

=== begin ===

#include <libgda.h>

int main() {
    GdaConnection *cnc;
    gda_init();
    cnc = gda_connection_open_from_string("SQLite", "DB_DIR=.;DB_NAME=test", NULL, GDA_CONNECTION_OPTIONS_NONE, NULL);
    g_object_unref(cnc);
    return EXIT_SUCCESS;
}

=================================================================
==12278==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 72 byte(s) in 3 object(s) allocated from:
    #0 0x7f69088a0cdd in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/liblsan.so.0+0xccdd)
    #1 0x7f6906c5f780 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f780)

Direct leak of 15 byte(s) in 3 object(s) allocated from:
    #0 0x7f69088a0795 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/liblsan.so.0+0xc795)
    #1 0x7f690737d521 in xmlStrdup (/usr/lib/x86_64-linux-gnu/libxml2.so.2+0xd4521)

Indirect leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7f69088a0795 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/liblsan.so.0+0xc795)
    #1 0x7f6906c5f728 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f728)

SUMMARY: LeakSanitizer: 97 byte(s) leaked in 7 allocation(s).

Process finished with exit code 23

== end ===

The first test was using latest libgda stable, but found leaks in version from trunk too. (6.0)

My CMake file:

=== begin ===

cmake_minimum_required(VERSION 3.6)
project(testes)

set(CMAKE_C_STANDARD 99)

set(CMAKE_C_FLAGS "-g -fsanitize=leak")

add_definitions(-I/usr/local/include/libgda-6.0)
add_definitions(-I/usr/local/include/libgda-6.0/libgda)
add_definitions(-I/usr/include/glib-2.0)
add_definitions(-I/usr/lib/x86_64-linux-gnu/glib-2.0/include)
add_definitions(-I/usr/include/libxml2)

set(SOURCE_FILES main.c)
add_executable(testes ${SOURCE_FILES})
target_link_libraries(testes gda-6.0 gobject-2.0 gthread-2.0 pthread glib-2.0 xml2)

=== end ===

My environment:

OS Xubuntu 16.04 64 bits
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
$ pkg-config glib-2.0 libgda-5.0 --modversion 
2.48.1
5.2.4
Comment 1 Daniel Espinosa 2017-02-01 15:44:16 UTC
While I'm not an expert in LeakSanitizer, I can't see any reference to libgda so library, just on libxml2 and glib. Are you sure is a GDA related leak?

Any way, may you should use SQLite installed in your system and avoid embedded one.
Comment 2 silvioprog 2017-02-03 16:46:44 UTC
Hello Daniel, thanks a lot for replying! So, could you reproduce that problem? I have a very basic knowledge about LeakSanitizer too, but it really seems a leak in GDA, because I'm using LibXML2 in other projects and it doesn't produce memory leaks. :-/ Anyway, doing a deep debug at GDA we could get what is causing that leaks.
Comment 3 Murray Cumming 2017-04-19 17:48:00 UTC
valgrind might give you some more clues.
Comment 4 GNOME Infrastructure Team 2018-09-21 13:57:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libgda/issues/126.