2013-09-19 2 views
2

я столкнулся с проблемой .. Когда я запустить Valgrind с моей программе я получил следующий вывод и запутать меня:Valgrind больше, чем ALLOCS FreeS, но никаких утечек

==12919== HEAP SUMMARY: 
==12919==  in use at exit: 97,820 bytes in 1 blocks 
==12919== total heap usage: 17 allocs, 16 frees, 99,388 bytes allocated 
==12919== 
==12919== LEAK SUMMARY: 
==12919== definitely lost: 0 bytes in 0 blocks 
==12919== indirectly lost: 0 bytes in 0 blocks 
==12919==  possibly lost: 0 bytes in 0 blocks 
==12919== still reachable: 97,820 bytes in 1 blocks 
==12919==   suppressed: 0 bytes in 0 blocks 
==12919== Reachable blocks (those to which a pointer was found) are not shown. 
==12919== To see them, rerun with: --leak-check=full --show-reachable=yes 
==12919== 
==12919== For counts of detected and suppressed errors, rerun with: -v 
==12919== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6) 

ответ

2

я обнаружил, что это было вызвано компиляции с флагом "-pg". Без него все в порядке!

0

От valgrind faq

5.2. С детектором утечки памяти Memcheck в чем разница между «определенно потерянным», «косвенно потерянным», «возможно потерянным», «все еще достижимым» и «подавленным»?

Подробности приведены в разделе Memcheck руководства пользователя.

Короче:

"definitely lost" means your program is leaking memory -- fix those leaks! 

"indirectly lost" means your program is leaking memory in a pointer-based structure. (E.g. if the root node of a binary tree is "definitely lost", all the children will be "indirectly lost".) If you fix the "definitely lost" leaks, the "indirectly lost" leaks should go away. 

"possibly lost" means your program is leaking memory, unless you're doing unusual things with pointers that could cause them to point into the middle of an allocated block; see the user manual for some possible causes. Use --show-possibly-lost=no if you don't want to see these reports. 

"still reachable" means your program is probably ok -- it didn't free some memory it could have. This is quite common and often reasonable. Don't use --show-reachable=yes if you don't want to see these reports. 

"suppressed" means that a leak error has been suppressed. There are some suppressions in the default suppression files. You can ignore suppressed errors. 
Смежные вопросы