9 ms·
Do they catch more issues? I thought valgrind was the gold standard. I would be happy to be proven wrong!
by adrianN 3y ago
Do they catch more issues? I thought valgrind was the gold standard. I would be happy to be proven wrong!
- PhilipRoman 3y agoIts a tradeoff, they both specialize for slightly different situations. Sanitizers have intricate knowledge of what is undefined behavior at a source level. For example signed integer overflow, etc. Some of these are simply not possible to determine at runtime, as a valid C program is allowed to generate the same machine code as one containing UB. Valgrind, on the other hand, cares purely about the machine code (with a few exceptions like malloc, free, etc.). It can peek into your libraries even if they aren't compiled with sanitizer flags. It is especially good for finding uninitialized memory usage - IIRC it can track this data even on the level of individual bits in a register.