[英]Memory/Address Sanitizer vs Valgrind
I want some tool to diagnose use-after-free bugs and uninitialized bugs.我想要一些工具来诊断释放后使用错误和未初始化的错误。 I am considering Sanitizer(Memory and/or Address) and Valgrind.我正在考虑消毒剂(内存和/或地址)和 Valgrind。 But I have very little idea about their advantages and disadvantages.但我对它们的优缺点知之甚少。 Can anyone tell the main features, differences and pros/cons of Sanitizer and Valgrind?谁能说出 Sanitizer 和 Valgrind 的主要功能、差异和优缺点?
Edit: I found some of comparisons like: Valgrind uses DBI(dynamic binary instrumentation) and Sanitizer uses CTI(compile-time instrumentation).编辑:我发现了一些比较,例如:Valgrind 使用 DBI(动态二进制检测)而 Sanitizer 使用 CTI(编译时检测)。 Valgrind makes the program much slower(20x) whether Sanitizer runs much faster than Valgrind(2x).无论 Sanitizer 运行速度比 Valgrind(2x) 快得多,Valgrind 都会使程序变慢 (20x)。 If anyone can give me some more important points to consider, it will be a great help.如果有人能给我一些更重要的考虑点,那将是一个很大的帮助。
I think you'll find this wiki useful.我想你会发现这个wiki很有用。
TLDR main advantages of sanitizers are TLDR 消毒剂的主要优点是
Disadvantages are缺点是
One big difference is that the LLVM-included memory and thread sanitizers implicitly map huge swathes of address space (eg, by calling mmap(X, Y, 0, MAP_NORESERVE|MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE, -1, 0)
across terabytes of address space in the x86_64 environment).一个很大的区别是包含 LLVM 的内存和线程清理器隐式地映射大量的地址空间(例如,通过调用mmap(X, Y, 0, MAP_NORESERVE|MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE, -1, 0)
跨 TB 的地址x86_64 环境中的空间)。 Even though they don't necessarily allocate that memory, the mapping can play havoc with restrictive environments (eg, ones with reasonable settings for ulimit
values).即使它们不一定分配该内存,映射也会对限制性环境(例如,对ulimit
值进行合理设置的环境)造成严重破坏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.