I'm trying to detect "Use after free()" bugs, otherwise known as "Dangling pointers". I know Valgrind can be used to detect "Use after free" bugs on the *nix platform, but what about windows? What if I don't have the source? Is there a better program than Valgrind for detecting all dangling pointers in a program? A free and open source would be preferred , but I'll use a commercial solution if it will get the job done.
The MSVC debug memory allocator already does this. When you get 0xfeeefeee from a pointer dereference you've dangled. With some luck that will bomb the program.
You can use gflags.exe
and the Debugging Tools for Windows to enable heap checking in a process:
It's been a while since I've used this, and I honestly can't remember how well it interacts with the C runtime heap as opposed to the Windows heap manager (to ensure that each malloc()
/free()
/new
/delete
call is separately checked).
Free, but not open source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With