Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-549

mongoc_init() and mongoc_cleanup() may make memory “still reachable”

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      I have a class to do mongodb operation using mongodb-c-driver. In the constructor, mongoc_init() is called. In deconstructor, mongoc_cleanup() is called. Then, valgrind 3.10.1 told me that some memory "still reachable". Part of the valgrind output is following:

      ==23222== 16,384 bytes in 1 blocks are still reachable in loss record 586 of 586

      ==23222== at 0x4C2D199: realloc (vg_replace_malloc.c:692)

      ==23222== by 0x6243894: CRYPTO_realloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)

      ==23222== by 0x62BE1F1: lh_insert (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)

      ==23222== by 0x62C0828: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)

      ==23222== by 0x62C0243: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)

      ==23222== by 0x5FCB01D: ERR_load_SSL_strings (in /lib/x86_64-linux-gnu/libssl.so.1.0.0)

      ==23222== by 0x5083623: _mongoc_ssl_init (in /usr/local/lib/libmongoc-1.0.so.0.0.0)

      ==23222== by 0x5077028: _mongoc_do_init (in /usr/local/lib/libmongoc-1.0.so.0.0.0)

      ==23222== by 0x529A3FF: pthread_once (pthread_once.S:104)

      ==23222== by 0x400F305: call_init.part.0 (dl-init.c:85)

      ==23222== by 0x400F3DE: call_init (dl-init.c:52)

      ==23222== by 0x400F3DE: _dl_init (dl-init.c:134)

      ==23222== by 0x40016E9: ??? (in /lib/x86_64-linux-gnu/ld-2.15.so)

      ==23222== LEAK SUMMARY:

      ==23222== still reachable: 91,832 bytes in 3,075 blocks

      When I commented these two functions, mongoc_init() and mongoc_cleanup(), valgrind told me that All heap blocks were freed.

      It seems that it is the problem of the mongodb-c-driver. Others reported the same issue under mongodb c driver project. https://jira.mongodb.org/browse/CDRIVER-478

      Any idea?

      Thanks.

            Assignee:
            bjori Hannes Magnusson
            Reporter:
            cpei Chengcheng Pei
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: