5 ms·
Twenty Years of Valgrind (2022)
- moomin 2y agoAs for the pronunciation, thanks for the tooling, but we’ll take it from here.
- mistrial9 2y agoagree - "grinned" is not at all the feeling I get.."grind" on the other hand, like skating.. yes more like it
- Sesse__ 2y agoAFAIK it's from the old Norse word “grind” meaning fence or gate. It's the entrance to Valhalla.
- perihelions 2y agobecause if you die on a skateboard that's the place you are taken to, it is the etymological root
- kimixa 2y agoAnd the times you end up needing tools like valgrind very much feel like a grind
- cortesoft 2y agoYeah, I feel like this is like GIF… the word takes on a life of its own, and the creator of the name does not get final say.
- nirvdrum 2y agoA key difference, to me at least, is that it's not a made up word (well, no more than any other established word). Ambiguity over its pronunciation comes from lack of familiarity with the source language. That's fine, we all need to learn, but to insist the native speaker is pronouncing it wrong seems a bit odd to me.
- cortesoft 2y agoAll sorts of words are pronounced differently by native speakers depending on their accent.
- jepler 2y agoat $OLD_JOB I literally joked that we used a fork of valgrind just to fix the pronunciation. of course, our fork was also years behind the official version. these days, since I am doing bare metal embedded, I barely use valgrind; but it is game changing in the situations where it's useful.
- ahartmetz 2y agoNo trouble at all here (German) - it's simply pronounced as if it was a German word.
- ahartmetz 2y ago(Well, its original nordic pronunciation probably has a more o-like or anyway different 'a', a pointier 'i' sound, and a stronger 'r' than in German. But it seems to be accepted practice between Germanic languages to pronounce everything as if it was your native language - it's easy and ~always intelligible.)
- Sesse__ 2y agoIf the “a” is supposed to be as in “value” (i.e. closer to ä in some but not all German dialects), that doesn't match typical German pronunciation, does it? (The -grind part is fine.)
- deleted 2y ago[deleted]
- jmclnx 2y agoA great tool, I hope these fortune 500 Companies that are involve with Linux are supporting the Valgrind Developers. In reality I really doubt they are.
- orochimaaru 2y agoFortune 500’s rarely contribute but use a lot. I work for one. It’s usually a tussle between which vendor has managed to convince c-suite that software engineering is a dying discipline and their new genai tool is the utopia. Most Fortune 500 c suite are bean counters with abysmal engineering or product know how. They can’t see past the next quarter earnings report. I doubt long term contribution to meaningful open source is on their list.
- bluGill 2y agoEventually they brought in a tool so bad that we were able to show how much less productive it was. I'm not supposed to talk about it publically though.
- Foobar8568 2y agoF500 are the cemetery of IT people.
- deleted 2y ago[deleted]
- ChrisArchitect 2y agotwenty-four years (2022) Some discussion then: https://news.ycombinator.com/item?id=32245136 https://news.ycombinator.com/item?id=32245136
- munchler 2y ago2024 - 2022 + 20 = 22 years, not 24 years.
- theideaofcoffee 2y agoIn a complex C codebase, valgrind is absolutely indispensable for finding the last few bits of memory that may have leaked out because you got lazy and didn't free() or maybe you wrote somewhere in memory you shouldn't have, it really is like magic sometimes. I know that more recent languages (and some not so recent, looking at you, Ada!) have a lot of this built in by default, but when you need to do these things, you know you need to and it's nice to have a handy all-in-one tool to help out. It's saved me many times from myself when I was writing network code in C and I couldn't figure out where the leaks were coming from, or a performance regression by inspecting the code alone. A quick run of valgrind had that fixed in minutes.
- flohofwoe 2y agoIME the main problem with Valgrind is that it reduces performance too much (I remember something around 10x slowdown or worse). Clang's address sanitizer OTH finds most of the same problems, but with much a smaller performance hit, which makes it also useable for things like games. Also for leak detection, some IDEs have excellent realtime debugging tools (for instance there a very nice memory debugger in Visual Studio since VS2015, and XCode has Instruments).
- theideaofcoffee 2y agoGood point, there definitely is the performance hit for the observability data it gives you, but for me, that's a fair trade for the results it gets me. I can see how working with things that have more realtime-ish constraints like games would be more greatly affected. Still, works super well for systems software, so I continue to use it.
- michael1999 2y agoI remember how much my work improved when I got to use Purify. The pager just stopped going off after a while.
- ta8645 2y agoDid you find it superior to Valgrind in some way?
- michael1999 2y agoNo. Purify was the commercial software that inspired Valgrind. It was Reed Hastings' first company, and I came across it working at a bank in 1996. I moved to Java with the millennium, and missed the rise of Valgrind. I'm just happy that everyone has good tools now. Writing C in those days was a rough business.
- ggm 2y agoMaybe it's just me, but I think people tend to drive by memory leaks nowadays because the footprint of binaries has grown, but the size of ram has grown more-erly. Proper big. I routinely run on 1TB memory 128 core racks, and I don't worry about free() much. I'm not humblebragging, I actually think this is lazy (!) and I would benefit from more explicitly thinking about the memory consequences of what I do but there are some things which I used to freak out about growing to GB and now, I regard it as an investment on the future me, running the same thing: It's very likely I've got it in a hash structure of some kind already. I just add columns to the dict() elements. Down the other end, I recall some friends getting code which I expected to have to run on a major rack host to build onto a small memory model rPi and they said rust did that: allowed them to get rid of the overhang of other languages expectations to runtime size and be explicit about use and free in the heap.
- loeg 2y agoI think the relative popularity of managed memory languages has grown and continues to grow. Even C++ is largely "managed" via mechanisms like unique_ptr, shared_ptr, or the standard collections. (Using new/delete directly is more or less a code smell these days.) C will always have a place, but despite working in it from 2011-2021 or so, I just don't use it at all these days. With "owned" allocations, you just don't need explicit free(). You're more likely to see memory leaks via unbounded collection size than actual unreferenced pointers.
- adrianN 2y agoEvery correct program manages memory. Doing it in a structured way just makes it less bugprone.
- vinkelhake 2y agoTracking down memory leaks is just one of things that valgrind can do.
- bayindirh 2y agoIn short, in my discipline, if you don’t free your memory you can eat a TB in 10 minutes. Moreover, if you fragment memory too much, then you’ll start to get segfaults when you want large segments of contiguous memory. Lastly, the same fragmentation will cause advanced libraries like Eigen to use many small memory areas, and jumping between them kills locality, hence causing you performance losses. I’m running tasks on (and administering) clusters with similar resources to yours, yet I always treat them like 486DXs with 4MB RAM, because I can’t restart them every week.
- o11c 2y agoOne thing I've never understood regarding valgrind - other than intentional leaks, are suppression files ever actually used due to an actual false positive, or is it just due to the bug being in someone else's code that's annoying to fix? "We implement our own memory allocator" is no excuse; the primitives you use should be hooked by valgrind so at most there should be false negatives due to your allocations being larger than the user-facing ones ...
- glandium 2y agoFirst and foremost, suppressions can be used for more than leaks. For example, for "Conditional jump or move depends on uninitialised value(s)", which yes, there are very much false positives for because of e.g. tricky optimizations LLVM performs and that valgrind can't handle. But even for leaks, you can also have intentional leaks that valgrind will flag but that you can't really do anything about. One example is how using `putenv` can lead to you having to leak memory on purpose. There are many other cases.
- wavesquid 2y ago> are suppression files ever actually used due to an actual false positive, There used to be one in LuaJIT because it had an optimized string comparison that compared outside of the allocation (which is allowed by the OS as long as you don't cross a page boundary, which LuaJIT's allocation algorithm made sure it never did) The suppression was removed in https://github.com/LuaJIT/LuaJIT/commit/ff34b48ddd6f2b3bdd26d6088662a214ba6b0288 https://github.com/LuaJIT/LuaJIT/commit/ff34b48ddd6f2b3bdd26... when the string hashing got a new implementation
- rwmj 2y agoYes, we use suppression files to cover expected leaks, as well as bugs in other code that is annoying to fix. For example the OCaml suppressions here are because OCaml (as expected) doesn't free static allocations at program exit. You can also see some real bugs we found: https://gitlab.com/nbdkit/nbdkit/-/tree/master/valgrind?ref_type=heads https://gitlab.com/nbdkit/nbdkit/-/tree/master/valgrind?ref_...
- turtledragonfly 2y agoI like Valgrind, but day-to-day, I find myself typically reaching for Sanitizers[1] instead (ASan, et. al.), especially since they're built-in to many compilers these days, and are a bit faster IME. Are there any use cases that people here have experienced where Valgrind is their first choice? [1] https://github.com/google/sanitizers https://github.com/google/sanitizers
- synergy20 2y agosame here, also for embedded systems valgrind is too heavy to run natively
- lbrandy 2y agoFor uninitialized memory reads, which is one of the biggest classes of issues, valgrind can still be invaluable. MSAN is one of the more difficult things to get setup and remove all the false positives. You typically need to transitively compile everything including dependencies, or annotate/hint lots of things to get the signal-to-noise ratio right. Sometimes its just easier/better/faster to run it under valgrind.
- patrick451 2y agoIME, sanitizer don't find enough issues compared valgrind, and valgrind doesn't require me to recompile the world. If I have anything that feels like UB, especially that I can trigger in a unit test, I run it through valgrind first. If the issue can only be triggered by running the whole system and valgrind slows it down too much, there's a good chance that sanitizers will also slow it down too much.
- nickelpro 2y agoCallgrind is indispensable for performance profiling and has no compiler-based equivalents
- Sesse__ 2y agoCallgrind is certainly dispensable; just use a profiler. They are much, much faster, and more accurate as well. (Callgrind is using an idealized model of CPUs as they were around 1995, which doesn't match up all that well with how they work today.) There are some situations where I find myself using Callgrind, in particular in situations where stack traces are hard to extract using a regular profiler. But overall, it's a tool that I find vastly overused.
- brcmthrowaway 2y agoHas anyone tried to Valgrind the rust runtime?
- pornel 2y agoIt works okay with Rust, but it's not really needed, except when integrating C code with Rust. For verifying unsafe code, Rust has a MIRI interpreter that catches UB more precisely, e.g. it knows Rust's aliasing rules, precise object boundaries, and has access to lifetimes (they don't survive compilation). Non-deliberate leaking of memory in Rust is not possible for the majority of Rust types. In safe Rust it requires a specific combination of a refcounted type that uses interior mutability which contains a type that makes the refcounted smart pointer recursive. Types that meet all three conditions at once are niche. The only annoyance/incompatibility is that Valgrind complains that global variables are leaked. Rust does that intentionally, because static destructors have the same problem as SIOF[1] in reverse, plus tricky interactions with atexit mean there's no reliable way to destruct arbitrary globals. [1]: https://en.cppreference.com/w/cpp/language/siof https://en.cppreference.com/w/cpp/language/siof
- vlovich123 2y agoHard disagree that it’s not needed. MIRI’s ability to verify non-trivial examples of code is quite limited so I generally just discount it. Valgrind goes beyond just asan+msan with heap and CPU profiling which can be useful if you’re trying to extract every last bit of performance.
- rwmj 2y agoYes we do, regularly, and unlike the other response, it's necessary as you can have leaks in C libraries even if they happen to be called from rust.
- dang 2y agoDiscussed at the time (of the article): Twenty years of Valgrind - https://news.ycombinator.com/item?id=32245136 https://news.ycombinator.com/item?id=32245136 - July 2022 (112 comments)
- aptitude_moo 2y ago> As a result, I don’t have much use for Memcheck, but 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/dcache results at all given that they come from a best-guess simulation of an AMD Athlon circa 2002.) The few times I used the cache simulator and compared it to (Linux) Perf I found reasonable results. Someone can recommend a better cache simulator?
- ellis0n 2y agoI remember adding 64-bit fixes to Valgrind to run it on the iOS Simulator when Macs went 64-bit, and I succeeded, it was incredible. Valgrind is one of the wonders created by humans.
- inglor_cz 2y agoOnce upon a time, I worked on a mathematical project that hit a SIGSEGV after about 10 hours of running. Unable to find the problem, I ran the task on valgrind. Took almost a week, but it showed me the reason nice and clear.
- kazinator 2y agoIt's about time to have hardware support for valgrind. I.E the synthetic CPU provided by libvex being partially moved to the hardware level, eliminating the dynamic translation.