-2
Rust Devs Think We’re Hopeless; Let’s Prove Them Wrong (with C++ Memory Leaks)!
www.babaei.netRust Devs Think We’re Hopeless; Let’s Prove Them Wrong (with C++ Memory Leaks)!
When Rust developers think of us C++ folks, they picture a cursed bloodline — generational trauma passed down from malloc to free. To them, every line of C++ we write is like playing Russian Roulette — except all six chambers are loaded with undefined behavior.
They look at us like we’re hopeless. Like we’re one dangling pointer away from therapy. But you know what? We don’t need a compiler nanny. No borrow checker. No lifetimes. No ownership models. No black magic. Not even Valgrind is required. Just raw pointers, raw determination, and a bit of questionable sanity.
So in this video, I’m going to show you how to hunt down memory leaks like you were born with a pointer in one hand and a debugger in the other.
If that sounds unreasonably dangerous — and incredibly fun — smash that subscribe button, and let’s dive into the deep end of the heap.
Look at all this stuff we need to do to track one one specific type of memory leak on one platform with a specific compiler! Yeah so much better then having things mostly work out the box so you don’t have to worry that much about it. Besides, rust does not actually guarantee no memory leaks. Leaking memory is not considered unsafe at all as it is very hard to systematically prevent. But it does make accidentally doing a memory leak harder when not doing weird things. But really memory leaking is not the major concern rust developers have with C++ - it is all the other actually unsafe memory stuff you need to worry about which this video does not even start to touch on.
And that is the big problem I and so many have with C/C++. Technically every problem that rust tries to solve and be solved in C/C++ without the borrow checker or other help the compiler gives you. But it is up to you to know all these tricks to finding the problems. It is up to you to actively look for them. It is up to you to know about them all and all the possibly foot guns you need to avoid. It is just nicer if the compiler actually helps you and works with you rather then letting you stumble around trying not to set off any landmines of manually managing memory.
On its own this is an interesting trick to find leaking memory in C++ (on windows with the windows compiler). It did not need to drag rust into the video and seemingly trys to claim that all the help the rust compiler gives you is pointless as you can manually and with a lot more effort find solutions to the same problems in C++…