TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Twenty years of Valgrind

626 点作者 nnethercote将近 3 年前

29 条评论

compiler-guy将近 3 年前
I sort of owe callgrind a big chunk of my career.<p>I was working at a company full of PhDs and well seasoned veterans, who looked at me as a new kid, kind of underqualified to be working in their tools group. I had been at the firm for a while, and they were nice enough, but didn&#x27;t really have me down as someone who was going to contribute as anything other than a very junior engineer.<p>We had a severe problem with a program&#x27;s performance, and no one really had any idea why. And as it was clearly not a sophisticated project, I got assigned to figure something out.<p>I used the then very new callgrind and the accompanying flamegraph, and discovered that we were passing very large bit arrays for register allocation <i>by value</i>. Very, very large. They had started small enough to fit in registers, but over time had grown so large that a function call to manipulate them effectively flushed the cache, and the rest of the code assumed these operations were cheap.<p>Profiling tools at the time were quite primitive, and the application was a morass of shared libraries, weird dynamic allocations and JIT, and a bunch of other crap.<p>Valgrind was able to get the profiles after failing with everything else I could try.<p>The presentation I made on that discovery, and my proposed fixes (which eventually sped everything up greatly), finally earned the respect of my colleagues, and no phd wasn&#x27;t a big deal after that. Later on, those colleagues who had left the company invited me to my next gig. And the one after that.<p>So thanks!
评论 #32245658 未加载
评论 #32250245 未加载
评论 #32248948 未加载
评论 #32247593 未加载
评论 #32246493 未加载
评论 #32249749 未加载
cjbprime将近 3 年前
I wish I hadn&#x27;t read this article because now I know that I&#x27;ve been mispronouncing Valgrind for nearly 20 years but I&#x27;m not going to stop.<p>(Kidding. Thanks for Valgrind! I still use it for assessing memory corruption vulnerabilities along with ASan.)
评论 #32245390 未加载
评论 #32246045 未加载
评论 #32246211 未加载
评论 #32245328 未加载
评论 #32247274 未加载
评论 #32246556 未加载
评论 #32245577 未加载
评论 #32247388 未加载
评论 #32245847 未加载
评论 #32247144 未加载
RustyRussell将近 3 年前
I once submitted a bug fix for an obscure issue to valgrind. They asked for a test case, which I managed to provide, but I was a bit nervous as I couldn&#x27;t immediately see how to fit in their test suite.<p>The response from Julian Seward was so nice it set a permanently high bar for me when random people I don&#x27;t know report bugs on my projects!<p>We still run our entire testsuite under valgrind in CI. Amazing tool!
评论 #32250339 未加载
nicoburns将近 3 年前
Well damn, no wonder he’s so good at optimising the Rust compiler. He literally has a PhD in profiling tools!
j1elo将近 3 年前
Valgrind is an amazingly useful tool. The biggest pain point, though, has always been to read through and process the huge amount of false positives that typically come from 3rd-party support libraries, such as GLib. It provides some suppression files to be used with Valgrind, but still, GLib has its own memory allocator, so things tend to go awry.<p>Running Helgrind or DRD (for threading issues) with GLib has been a bit frustrating, too. If anyone has some advice to share about this, I&#x27;m all ears!<p>(EDIT: I had mistakenly left out the phrase about suppression files)
nneonneo将近 3 年前
Hah, I teach my students to use Valgrind, <i>and</i> I’ve been pronouncing it wrong this whole time. Guess I’ll have to make sure to get that right next semester :)<p>The magic of Valgrind really lies in its ability to detect errors without recompiling the code. Sure, there’s a performance hit, but sometimes all you have is a binary. It’s damn solid on Linux, and works even with the custom threading library we use for the course; shame the macOS port is barely maintained (last I checked, it only worked on OSes from a few years back - anything more recent will execute syscalls during process startup that Valgrind doesn’t handle).
syockit将近 3 年前
There are times when LeakSanitizer (in gcc-8.2) would not give me the full backtrace of a leak, while valgrind would, so to me it&#x27;s still an indispensable tool for debugging leaks. One caveat is that it&#x27;s magnitudes slower than valgrind. Now, if only I know how to make valgrind run as fast as LeakSanitizer... (command line options?)
评论 #32245537 未加载
Olumde将近 3 年前
Happy birthday Valgrind. Next year you&#x27;ll be able to drink in the US!<p>Being a UK PhD holder, a sentence stood out out to me was a commentary&#x2F;comparison between UK and US PhDs: &quot;This was a three year UK PhD, rather than a brutal six-or-more year US PhD.&quot;<p>My cousin has a US PhD and judging from what he tells me. It is a lot more rigorous than UK PhDs.
评论 #32247638 未加载
评论 #32246713 未加载
t43562将近 3 年前
I was working on an application for Symbian mobile phones and I was able to implement large parts of it as a portable library - the bits which compressed results using a dictionary to make them tiny enough to fit into an SMS message or a UDP frame. This was before the days of flat-rate charges for internet access and we were trying to be very economical with data.<p>I was able to build and debug them on Linux with Valgrind finding many stupid mistakes and the library worked flawlessly on Symbian.<p>It&#x27;s just one of the many times that Valgrind has saved my bacon. It&#x27;s awesome.
gkhartman将近 3 年前
Many thanks for Valgrind. I can honestly say that it helped me become a better C++ programmer.
tarasglek将近 3 年前
Beyond raw technical ability, Nick and Julian were the kindest, most reasonable developers I&#x27;ve ever interacted with. I think a lot of Valgrind&#x27;s success stems from combination of sophisticated tech and approachability of the core team.
junon将近 3 年前
Valgrind&#x27;s maintainers are super pleasant and have been quite helpful in a number of cases I&#x27;ve personally had to reach out to them.<p>Lovely piece of software toward which I owe a lot of gratitude.
mynegation将近 3 年前
I am old enough that I started with Purify and I used Valgrind starting from the version 1.0, because Purify was commercial and Solaris only. It saved my behind multiple multiple times.
评论 #32246204 未加载
评论 #32246847 未加载
评论 #32245574 未加载
评论 #32247181 未加载
pjmlp将近 3 年前
&gt; Speaking of software quality, I think it’s fitting that I now work full time on Rust, a systems programming language that didn’t exist when Valgrind was created, but which basically prevents all the problems that Memcheck detects.<p>Just like Ada has been doing since 1983.
评论 #32247732 未加载
lma21将近 3 年前
When we moved to Linux, Valgrind was THE tool that saved our as*s day after day after day. An issue in production? rollback, valgrind, fix, push, repeat. Thank you for all the hard work, in fact i don&#x27;t i can thank you enough.
whimsicalism将近 3 年前
It&#x27;s unfortunate that so many of these great tools (like `perf` and I believe `valgrind`) are basically not available locally on the Mac.<p>And running in a container is not really a solution for most of these.
评论 #32245522 未加载
评论 #32247264 未加载
amelius将近 3 年前
One problem with Valgrind is that the thing you&#x27;re debugging should have been tested with Valgrind from the start, otherwise you&#x27;re just going to be flooded with false triggers.<p>Now imagine that you&#x27;re developing a new application and you want to use some library, and it <i>hasn&#x27;t</i> been tested with valgrind and generates tons of false messages. Should you then use it? Or look for an alternative library?
willfiveash将近 3 年前
I see the article mentions Solaris, an OS that I am very familiar with, which had me thinking about the memory corruption detection Solaris offerred. Among the development features Solaris supported were two memory corruption checking libraries (libumem, watchmalloc) that could easily be used without have to recompile binaries to link with them. Libumem had support for detecting memory leaks, buffer overruns, multiple frees, use of uninitialized data, use of freed data, etc... but it could not detect a read past an allocated buffer which is where watchmalloc came in handy. To use either with an executable binary was as easy as:<p>$ LD_PRELOAD=libumem.so.1 &lt;executable filename&gt;<p>I found a lot of memory corruption bugs using libumem in particular including some in MIT Kerberos that were severe enough to be considered security vulnerabilities. Sadly, Solaris is now in support mode thanks to Ellison and friends at Oracle.
ahartmetz将近 3 年前
Valgrind is fantastic.<p>Memcheck decreases the memory safety problem of C++ by about 80% in my experience - it really is a big deal. The compiler-based tools that require recompiling every library used are a bit impractical for large stacks such as the ones under Qt-based GUI applications. Several libraries, several build systems. But I hear that they are popular for CI systems in large projects such as web browsers, which probably have dedicated CI developers. There are also some IME rare problems that these tools can find that Memcheck can&#x27;t, which is due to information unavailable in compiled code. Still, Memcheck has the largest coverage by far.<p>Callgrind and Cachegrind give very precise, repeatable results, complementary to but not replacing perf and AMD &#x2F; Intel tooling which use hardware performance counters. I tend to use all of them. They all work without recompiling.
randomswede将近 3 年前
Not sure if it was still doing it in 2001, but in the 1997-1998 time-frame Purify also ran on HP-UX. The company I was working for at the time used it and we ended up finding a two-byte (IIRC) leak in the HP gethostbyname() library call (well, at least I think it was gethostbyname, it&#x27;s more than two decades ago).<p>That was one of the more annoying tickets to file. We could of course send them the binary, but it would not run without the Purify license file, and we weren&#x27;t comfortable to send off the license file as well. But, in the end, they accepted the bug. Not sure if there was every any fix, though.
mukundesh将近 3 年前
Using Cachegrind to get hardware independent performance numbers (<a href="https:&#x2F;&#x2F;pythonspeed.com&#x2F;articles&#x2F;consistent-benchmarking-in-ci&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pythonspeed.com&#x2F;articles&#x2F;consistent-benchmarking-in-...</a>)<p>Also used by SQLite in their performance measurement workflow(<a href="https:&#x2F;&#x2F;sqlite.org&#x2F;cpu.html#performance_measurement" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;cpu.html#performance_measurement</a>)
edsiper2将近 3 年前
First of all congratulations to Valgrind and the team behind it! This is an essential tool that help me personally over the years while developing.<p>What needs to be done to get Valgrind binaries available for MacOS (M1) ?, from a company perspective we are happy to support this work. If you know who&#x27;s interest and can accomplish this pls drop me an email to eduardo at calyptia dot com.
bayindirh将近 3 年前
I still use Valgrind memcheck for memory leak verification of a large piece of code I have developed, with a long end-to-end test.<p>Also, it has a nice integration with Eclipse which reflects the Valgrind memcheck output to the source files directly, enabling you to see where problems are rooted.<p>All in all, Valgrind is a great toolset.<p>P.S.: I was pronouncing Valgrind correctly! :)
vlmutolo将近 3 年前
&gt; I still use Cachegrind, Callgrind, and DHAT all the time. I’m amazed that I’m still using Cachegrind today, given that it has hardly changed in twenty years. (I only use it for instruction counts, though. I wouldn’t trust the icache&#x2F;dcache results at all given that they come from a best-guess simulation of an AMD Athlon circa 2002.)<p>I&#x27;m pretty sure I&#x27;ve seen people using the icache&#x2F;dcache miss counts from valgrind for profiling. I wonder how unreliable these numbers are.
评论 #32245555 未加载
appleflaxen将近 3 年前
What other great tools are there in the vein of valgrind and AFL?
评论 #32245935 未加载
评论 #32245602 未加载
评论 #32248024 未加载
评论 #32246480 未加载
amelius将近 3 年前
Are people using Valgrind on Python packages?<p>It seems some packages (even basic ones) are not compatible with Valgrind, thereby spoiling the entire debugging experience.
Sesse__将近 3 年前
I live not far from Valgrindvegen (Valgrind road); I&#x27;ve always wondered whether the developers knew it existed. :-)
anewpersonality将近 3 年前
Is Valgrind any use in Rust?
评论 #32247205 未加载
评论 #32249267 未加载
评论 #32247176 未加载
ssrs将近 3 年前
ive used valgrind quite extensively. a big thank you to the folks behind this!