所以给出了这个输出:
==80518== Invalid read of size 4
==80518== at 0x558D: Node::ReadFolder(GFile*) (in ./ScribeRecoverMail2)
==80518== by 0x7B61: Worker::Export(GFile*, GArray<Node*>&) (in ./ScribeRecoverMail2)
==80518== by 0x8F7A: Worker::Main() (in ./ScribeRecoverMail2)
==80518== by 0x142D64: ThreadEntryPoint(void*) (in /Users/matthew/Code/Scribe-Branches/v2.00/Utils/ScribeRecoverMail2/build/Debug/ScribeRecoverMail2.app/Contents/Frameworks/Lgi.framework/Versions/A/Lgi)
==80518== by 0x47E258: _pthread_start (in /usr/lib/libSystem.B.dylib)
==80518== by 0x47E0DD: thread_start (in /usr/lib/libSystem.B.dylib)
==80518== Address 0x1d72f590 is 16 bytes inside a block of size 72 alloc'd
==80518== at 0x41581: malloc (vg_replace_malloc.c:266)
==80518== by 0x3D5616: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==80518== by 0x77A6: Worker::Scan(GFile*, GArray<Node*>&) (in ./ScribeRecoverMail2)
==80518== by 0x8F0C: Worker::Main() (in ./ScribeRecoverMail2)
==80518== by 0x142D64: ThreadEntryPoint(void*) (in /Users/matthew/Code/Scribe-Branches/v2.00/Utils/ScribeRecoverMail2/build/Debug/ScribeRecoverMail2.app/Contents/Frameworks/Lgi.framework/Versions/A/Lgi)
==80518== by 0x47E258: _pthread_start (in /usr/lib/libSystem.B.dylib)
==80518== by 0x47E0DD: thread_start (in /usr/lib/libSystem.B.dylib)
==80518==
==80518== Invalid read of size 4
==80518== at 0x10B70F: GFile::Read(void*, int, int) (in /Users/matthew/Code/Scribe-Branches/v2.00/Utils/ScribeRecoverMail2/build/Debug/ScribeRecoverMail2.app/Contents/Frameworks/Lgi.framework/Versions/A/Lgi)
==80518== by 0x360E: Node::Read(GFile*, unsigned int&) (in ./ScribeRecoverMail2)
==80518== by 0x55CF: Node::ReadFolder(GFile*) (in ./ScribeRecoverMail2)
==80518== by 0x7B61: Worker::Export(GFile*, GArray<Node*>&) (in ./ScribeRecoverMail2)
==80518== by 0x8F7A: Worker::Main() (in ./ScribeRecoverMail2)
==80518== by 0x142D64: ThreadEntryPoint(void*) (in /Users/matthew/Code/Scribe-Branches/v2.00/Utils/ScribeRecoverMail2/build/Debug/ScribeRecoverMail2.app/Contents/Frameworks/Lgi.framework/Versions/A/Lgi)
==80518== by 0x47E258: _pthread_start (in /usr/lib/libSystem.B.dylib)
==80518== by 0x47E0DD: thread_start (in /usr/lib/libSystem.B.dylib)
==80518== Address 0x1a198900 is 0 bytes inside a block of size 24 alloc'd
==80518== at 0x41581: malloc (vg_replace_malloc.c:266)
==80518== by 0x3D5616: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==80518== by 0xDFADB: GFile::GFile() (in /Users/matthew/Code/Scribe-Branches/v2.00/Utils/ScribeRecoverMail2/build/Debug/ScribeRecoverMail2.app/Contents/Frameworks/Lgi.framework/Versions/A/Lgi)
==80518== by 0x8E4E: Worker::Main() (in ./ScribeRecoverMail2)
==80518== by 0x142D64: ThreadEntryPoint(void*) (in /Users/matthew/Code/Scribe-Branches/v2.00/Utils/ScribeRecoverMail2/build/Debug/ScribeRecoverMail2.app/Contents/Frameworks/Lgi.framework/Versions/A/Lgi)
==80518== by 0x47E258: _pthread_start (in /usr/lib/libSystem.B.dylib)
==80518== by 0x47E0DD: thread_start (in /usr/lib/libSystem.B.dylib)
Valgrind似乎在抱怨正常的日常行为。仍然分配有问题的块,并且访问在内存块的开始和结束内。那么为什么valgrind抱怨?
这个程序确实在Windows上崩溃了,所以我在Mac上构建它以对它进行valgrind并查看出错的地方。到目前为止,很多这些“内部错误”警告但没有什么可疑的“写入免费内存”或任何东西。我很困惑。
PS运行最新的稳定valgrind v3.7.0,编译并安装在我运行它的同一台机器上。我一直在使用valgrind,之前从未见过这种消息。
答案 0 :(得分:1)
Valgrind似乎在抱怨正常的日常行为
确实如此,这似乎是Mac OSX版Valgrind中的一个错误。
您可以尝试创建一个小测试用例并将其报告给Valgrind开发人员。
您也可以尝试address sanitizer并查看报告的内容。