Valgrind does not work with WSL?
It's definitely possible
I've encountered some problems installing it directly with apt
, however it can be installed manually with some very simple steps:
- Download the source file:
wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2
(by the time you read this there could be a newer version) - Extract the archive:
tar -xvjf valgrind-3.12.0.tar.bz2
- Configure the installation process:
cd
into the exctracted foldervalgrind-3.12.0
and then launch./configure
- Make: simply launch
make
while in thevalgrind-3.12.0
folder - Check the dependencies: launch
make check
to see whether all the dependencies necessary for the installation are satisfied (e.g: you'll have to install g++, just launchsudo apt install g++
) - Install valgrind: type
sudo make install
to install it
How to use Valgrind with WSL to profile a MSVC application on Windows 10?
Valgrind in WSL only works with linux binaries, not windows ones. If you recompile your binary for linux, you should be able to run valgrind on that.
Having troubles using Valgrind with WSL on CLion
Try to use Posix path /usr/bin/valgrind
.
https://www.jetbrains.com/help/clion/memory-profiling-with-valgrind.html#valgrind-wsl
Works for me.
WSL linux and valgrind
This is a known problem
https://bugs.kde.org/show_bug.cgi?id=419562
Bug 419562 - PR_SET_PTRACER error with Ubuntu on WSL
In the bug, you see that additional information is required.
How to use valgrind?
Valgrind is not available for Windows. On their home page, it says:
It runs on the following platforms: X86/Linux, AMD64/Linux, ARM/Linux, ARM64/Linux, PPC32/Linux, PPC64/Linux, PPC64LE/Linux, S390X/Linux, MIPS32/Linux, MIPS64/Linux, X86/Solaris, AMD64/Solaris, ARM/Android (2.3.x and later), ARM64/Android, X86/Android (4.0 and later), MIPS32/Android, X86/Darwin and AMD64/Darwin (Mac OS X 10.12).
For alternatives, you can refer to this stackoverflow question. Many people have listed other options.
EDIT:
Since you are using WSL, that does change things. (Next time, it would be good to add that sort of information to your question. Even if Valgrind worked on Windows, using WSL does change the answer.) You should know that valgrind will only work for Linux binaries then. You won't be able to use Visual Studio code.
Otherwise, it should technically be possible, but I've worked with WSL and since it's still in its early stages, things don't always work as you expect. It might just be in your case though, that you need to do the first possible fix by sudo apt install libc6-dbg
.
If that doesn't work, here is an answer about how to install it. No guarantees that this works though for you.
Clion unable to find project executable when using valgrind with CLion on windows
Solved:
- Go to File -> Settings -> Build, Execution, Deployment
- Remove any Toolchains other than WSL (making WSL the default will probably work as well)
- Profit
Related Topics
What Is Partition Checker in Arm Secure Mode
Comparing Two Files in Linux Terminal
Understanding Load Average VS. CPU Usage
How to Set Limit on Directory Size in Linux
Move Files to Directories Based on Extension
Execute Two Commands with Docker Exec
Using Mkdir -M -P and Chown Together Correctly
How to Mount a Usb Drive on Android Things
Create a Symbolic Link of Directory in Ubuntu
How to Call Matlab Functions from the Linux Command Line
What Does the 2> Mean on the Unix Command-Line
Examining C/C++ Heap Memory Statistics in Gdb
Gcc Compiled Binaries Give "Cannot Execute Binary File"