Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there Valgrind Memcheck like tool for windows to debug use after free errors? [closed]

Tags:

Durring my work I regulary face rather common programming error - using some object which has already been freed. This invokes UB in C++. On linux, this kind of problems are usually resolved by using Valgrind tool Memcheck. From Memcheck manual:

Memcheck tries to establish what the illegal address might relate to, since that's often useful. So, if it points into a block of memory which has already been freed, you'll be informed of this, and also where the block was freed.

Memcheck provides me call stack, where the object was deallocated and I can go on and debug the problem. Is there similar tool for windows with the same functionality, preferably free?

like image 281
ks1322 Avatar asked Mar 28 '12 16:03

ks1322


People also ask

Can valgrind be used on Windows?

Valgrind Memcheck is a tool for detecting memory-usage problems such as leaks, invalid memory access, incorrect freeing, and referencing undefined values. Valgrind integration in CLion works on Linux, macOS, and Windows via WSL (see Valgrind on WSL).

Is valgrind a debugging tool?

Valgrind (/ˈvælɡrɪnd/) is a programming tool for memory debugging, memory leak detection, and profiling. Valgrind was originally designed to be a free memory debugging tool for Linux on x86, but has since evolved to become a generic framework for creating dynamic analysis tools such as checkers and profilers.

What is the difference between valgrind and gdb?

The GNU Debugger (GDB) allows you to pause a running program and inspect its state. Valgrind's memcheck monitors a program's memory accesses and prints warnings if the program accesses invalid locations or attempts to read values that the program never set (initialized).

What is valgrind and how can we use it to debug memory problems?

Valgrind is a multipurpose code profiling and memory debugging tool for Linux when on the x86 and, as of version 3, AMD64, architectures. It allows you to run your program in Valgrind's own environment that monitors memory usage such as calls to malloc and free (or new and delete in C++).


1 Answers

As Lailin Chen pointed out in his answer to this question try one of these:

Dr. Memory: https://github.com/dynamorio/drmemory

UMDH: http://support.microsoft.com/kb/268343

AppVerifier: http://msdn.microsoft.com/en-us/library/dd371695%28v=vs.85%29.aspx

like image 141
stanwise Avatar answered Dec 29 '22 12:12

stanwise