valgrind的未初始化值错误的可重复性问题

时间:2014-02-04 08:24:16

标签: c++ valgrind

我正在使用valgrind来跟踪内存错误。我注意到valgrind有时会针对相同的代码和测试条件检测到未初始化的值错误。可能是这种奇怪行为的原因是什么?

Run1:
valgrind --leak-check=full --track-origins=yes ./parcob cobalt_tet map_tet 
==14034== Use of uninitialised value of size 8
==14034==    at 0x36936D5B20: profil_counter (in /lib64/libc-2.5.so)
==14034==    by 0x36936302CF: ??? (in /lib64/libc-2.5.so)
==14034==    by 0x369AE7290C: std::istream::operator>>(int&) (in /usr/lib64/libstdc++.so.6.0.8)
==14034==    by 0x414C68: mesh::__FVMESH<int, double>::ReadCobaltMesh(char const*, char const*) (unsmesh_io.h:975)
==14034==    by 0x419948: main (main.cpp:47)
==14034==  Uninitialised value was created by a stack allocation
==14034==    at 0x369AE4E3C0: ??? (in /usr/lib64/libstdc++.so.6.0.8)
==14034== 
==14034== 
==14034== HEAP SUMMARY:
==14034==     in use at exit: 263,884 bytes in 1 blocks
==14034==   total heap usage: 8,923 allocs, 8,922 frees, 495,130 bytes allocated
==14034== 
==14034== LEAK SUMMARY:
==14034==    definitely lost: 0 bytes in 0 blocks
==14034==    indirectly lost: 0 bytes in 0 blocks
==14034==      possibly lost: 0 bytes in 0 blocks
==14034==    still reachable: 263,884 bytes in 1 blocks
==14034==         suppressed: 0 bytes in 0 blocks
==14034== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Run2
valgrind --leak-check=full --track-origins=yes ./parcob cobalt_tet map_tet 
==14035== 
==14035== HEAP SUMMARY:
==14035==     in use at exit: 263,884 bytes in 1 blocks
==14035==   total heap usage: 8,923 allocs, 8,922 frees, 495,130 bytes allocated
==14035== 
==14035== LEAK SUMMARY:
==14035==    definitely lost: 0 bytes in 0 blocks
==14035==    indirectly lost: 0 bytes in 0 blocks
==14035==      possibly lost: 0 bytes in 0 blocks
==14035==    still reachable: 263,884 bytes in 1 blocks
==14035==         suppressed: 0 bytes in 0 blocks
==14035== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

很抱歉发布了详细的输出。

注意:应用程序是使用英特尔编译器套件编译的

0 个答案:

没有答案