Valgrind on Windows?

With the Valgrind-on-Mac support coming along nicely, it’s worth addressing another widely-used platform:  Windows.  Will Valgrind work on Windows any time soon?  There are actually two answers:  (a) hell no, and (b) it already does (sort of).

The patch I merged from the Darwin branch onto the trunk yesterday was 28,300 lines.  And that was almost entirely new code, because I’d done a lot of work to synchronize the branch and trunk so that all non-addition changes had been dealt with.  Greg Parker spent over four years, off and on, working on the original port, and I spent close to three months full time cleaning it up, and Julian Seward also pitched in a bit.  I roughly estimate the Darwin port represents at least 1,000 person-hours of work, possibly much more.

And Mac OS X is a lot closer to Linux than Windows is.  Also, the Mac OS X kernel is open source, which makes a port much easier.  A Valgrind-on-Windows port would therefore be an enormous undertaking, one that is unlikely to happen soon, if ever.  That is how we get answer (a) above.

However, although Valgrind doesn’t run on Windows, it is possible to run Windows programs under Valgrind, thanks to Wine — you run the Windows program under Wine, and Wine under Valgrind.  The development (trunk) versions of both Valgrind and Wine now have enough awareness of each other that they can apparently be used together.  I say “apparently” because I haven’t tried it myself, but I know that others have had some success.  But please note that this is fairly new and experimental, and should only be tried by those not afraid to get their hands dirty (this page has more details). And that’s how we get the answer (b) above.

4 Responses to Valgrind on Windows?

  1. Tom Hughes

    There are still some significant problems running things under wine with valgrind, at least on some linux distributions.

    I believe Ubuntu may work better but certainly on Fedora there are still problems relating to address space issues and where things get placed.

  2. “it’s worth addressing a* much, much more* widely-used platform: Windows”

    - Fixed that for ya.

  3. Mediocrebeing

    While Windows is much much more widely-used, only a tiny fraction of Windows users are developers and a small fraction of developers write C programs. In comparison, a good fraction of Linux users are C developers for whom valgrind is designed.

  4. Windows users also currently have the option of running Microsoft’s free Application Verifier:

    http://www.microsoft.com/downloads/details.aspx?familyid=c4a25ab9-649d-4a1b-b4a7-c9d8b095df18

    that’s just as easy to use as Valgrind and provides a lot of the basic memcheck features. And Microsoft is actively updating App Verifier. So while Valgrind on Windows would be cool, I’m not sure if it’ll ever really be worth the effort.