Я пытаюсь точно определить ошибки памяти приложения с valgrind.
Valgrind демонстрирует странное поведение, которого я не наблюдал до сих пор: Valgrind печатает сводку с ошибками во время работы приложения, но сообщает всепо окончании освобождается без утечек
К сожалению, я не могу раскрыть исходный код приложения, но могу сказать, что
- приложение является многопоточным
- приложение использует zmq
- приложение написано на C ++ (11)
- приложение построено с помощью gcc-4.9.2
- работает на Debian: Debian 3.16.0-4-amd64 # 1 SMP Debian 3.16.51-3 (2017-12-13) x86_64 GNU / Linux (от uname -a)
- Я скачал исходный моментальный снимок valgrind 3.13.0 и построил его на том жесистема с тем же компилятором
Может быть, у кого-то есть подсказка или подсказка, что здесь происходит?Я не уверен, что программа работает нормально или нет.При отладке или тестировании я не обнаруживаю проблем с приложением, то есть также с подключенным GDB, приложение выполняет постепенное завершение работы.
Вот что происходит:
valgrind ./<application>
==11431== Memcheck, a memory error detector
==11431== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==11431== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==11431== Command: ./<<application>>
==11431==
<< output from application being analyzed >>
==11446==
==11446== HEAP SUMMARY:
==11446== in use at exit: 36,963,243 bytes in 12,456 blocks
==11446== total heap usage: 112,306 allocs, 99,850 frees, 167,728,353 bytes allocated
==11446==
==11446== LEAK SUMMARY:
==11446== definitely lost: 13,419 bytes in 163 blocks
==11446== indirectly lost: 24,368 bytes in 486 blocks
==11446== possibly lost: 5,741 bytes in 106 blocks
==11446== still reachable: 36,919,715 bytes in 11,701 blocks
==11446== of which reachable via heuristic:
==11446== stdstring : 211,119 bytes in 5,162 blocks
==11446== suppressed: 0 bytes in 0 blocks
==11446== Rerun with --leak-check=full to see details of leaked memory
==11446==
==11446== For counts of detected and suppressed errors, rerun with: -v
==11446== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==11448==
==11448== HEAP SUMMARY:
==11448== in use at exit: 37,699,870 bytes in 12,837 blocks
==11448== total heap usage: 115,854 allocs, 103,017 frees, 168,950,644 bytes allocated
==11448==
==11448== LEAK SUMMARY:
==11448== definitely lost: 14,252 bytes in 155 blocks
==11448== indirectly lost: 24,864 bytes in 498 blocks
==11448== possibly lost: 5,749 bytes in 106 blocks
==11448== still reachable: 37,655,005 bytes in 12,078 blocks
==11448== of which reachable via heuristic:
==11448== stdstring : 214,732 bytes in 5,238 blocks
==11448== suppressed: 0 bytes in 0 blocks
==11448== Rerun with --leak-check=full to see details of leaked memory
==11448==
==11448== For counts of detected and suppressed errors, rerun with: -v
==11448== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==11449==
==11449== HEAP SUMMARY:
==11449== in use at exit: 37,817,537 bytes in 12,875 blocks
==11449== total heap usage: 119,125 allocs, 106,250 frees, 170,106,138 bytes allocated
==11449==
==11449== LEAK SUMMARY:
==11449== definitely lost: 12,013 bytes in 146 blocks
==11449== indirectly lost: 24,864 bytes in 498 blocks
==11449== possibly lost: 5,749 bytes in 106 blocks
==11449== still reachable: 37,774,911 bytes in 12,125 blocks
==11449== of which reachable via heuristic:
==11449== stdstring : 215,361 bytes in 5,252 blocks
==11449== multipleinheritance: 992 bytes in 1 blocks
==11449== suppressed: 0 bytes in 0 blocks
==11449== Rerun with --leak-check=full to see details of leaked memory
==11449==
==11449== For counts of detected and suppressed errors, rerun with: -v
==11449== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
<< output from application being analyzed, app is shutting down now >>
==11431==
==11431== HEAP SUMMARY:
==11431== in use at exit: 0 bytes in 0 blocks
==11431== total heap usage: 343,376 allocs, 343,376 frees, 329,511,726 bytes allocated
==11431==
==11431== All heap blocks were freed -- no leaks are possible
==11431==
==11431== For counts of detected and suppressed errors, rerun with: -v
==11431== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)