1
Valgrind給我一個still reachable
記錄與mongocxx ::實例inst {};使用mongocxx :: inst {}執行內存泄漏;
==3014== 16,384 bytes in 1 blocks are still reachable in loss record 609 of 609
==3014== at 0x5374C20: realloc (vg_replace_malloc.c:662)
==3014== by 0x396046ACCE: CRYPTO_realloc (in /usr/lib64/libcrypto.so.1.0.1e)
==3014== by 0x39604E604D: lh_insert (in /usr/lib64/libcrypto.so.1.0.1e)
==3014== by 0x39604E87C8: ??? (in /usr/lib64/libcrypto.so.1.0.1e)
==3014== by 0x39604E814B: ??? (in /usr/lib64/libcrypto.so.1.0.1e)
==3014== by 0x396054C2FD: ERR_load_CMS_strings (in /usr/lib64/libcrypto.so.1.0.1e)
==3014== by 0x3963045A38: SSL_load_error_strings (in /usr/lib64/libssl.so.1.0.1e)
==3014== by 0x62BD653: ??? (in /usr/lib64/libmongoc-1.0.so.0.0.0)
==3014== by 0x62A2278: ??? (in /usr/lib64/libmongoc-1.0.so.0.0.0)
==3014== by 0x395BC0CE02: pthread_once (in /lib64/libpthread-2.12.so)
==3014== by 0x55ADDE5: std::unique_ptr<mongocxx::v_noabi::instance::impl, std::default_delete<mongocxx::v_noabi::instance::impl> > core::v1::make_unique<mongocxx::v_noabi::instance::impl, void, std::unique_ptr<mongocxx::v_noabi::logger, std::default_delete<mongocxx::v_noabi::logger> > >(std::unique_ptr<mongocxx::v_noabi::logger, std::default_delete<mongocxx::v_noabi::logger> >&&) (in /usr/lib64/libmongocxx.so.3.0.3)
==3014== by 0x55ADAEE: mongocxx::v_noabi::instance::instance(std::unique_ptr<mongocxx::v_noabi::logger, std::default_delete<mongocxx::v_noabi::logger> >) (in /usr/lib64/libmongocxx.so.3.0.3)
==3014== by 0x55ADCF4: mongocxx::v_noabi::instance::instance() (in /usr/lib64/libmongocxx.so.3.0.3)
==3014== by 0x4F6188: main (main.c:280)
我該如何擺脫這一點。 我在fork之後但在創建任何線程之前聲明實例。