2015년 1월 1일 목요일

Possible memory leak in c++ client driver?

Merry Christmas!

I'm using mongodb c++ client in my program, but when I try to check memory leak of my program with the following valgrind command:

valgrind -v --trace-children=yes --tool=memcheck --leak-check=full --log-file=valgrind.log ./a.out

I see such report:

389 ==17265== 40 bytes in 1 blocks are definitely lost in loss record 32 of 49
390 ==17265==    at 0x4C2C7A7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
391 ==17265==    by 0x5971274: mongo::BackgroundJob::JobStatus::JobStatus() (mutex.h:79)
392 ==17265==    by 0x596E027: mongo::BackgroundJob::BackgroundJob(bool) (background.cpp:133)
393 ==17265==    by 0x593513C: mongo::ReplicaSetMonitorWatcher::ReplicaSetMonitorWatcher() (dbclient_rs.cpp:68)
394 ==17265==    by 0x58EBBDF: _GLOBAL__sub_I_dbclient_rs.cpp (dbclient_rs.cpp:151)
395 ==17265==    by 0x400F875: call_init.part.0 (dl-init.c:84)
396 ==17265==    by 0x400F92F: _dl_init (dl-init.c:55)
397 ==17265==    by 0x4001689: ??? (in /lib/x86_64-linux-gnu/ld-2.17.so)
398 ==17265==    by 0x1: ???
399 ==17265==    by 0x7FF000142: ???
400 ==17265==    by 0x7FF000175: ???
401 ==17265==

I'm wondering if it is a false report by valgrind? Or I'm using mongodb client APIs incorrectly?
Or is it a real memory leak?

Thank you all in advance!



hi, I encounter this problem like you. Is this a real memory leak?



n general, please don't re-open very old threads. It is better to start a new thread.

As for the memory leak, could you please provide some additional details:

- What version of the C++ driver are you using
- How did you build the driver?
- What platform are you using?
- What version of valgrind are you using?
- What was the valgrind output?
- If you have a small, self contained compilable test case that demonstrates the issue when run under valgrind, that would be a big help.


댓글 없음:

댓글 쓰기