Skip to content
DevMeme
5027 of 7435
Rust's Safety Mob vs. C's Manual Memory Mayhem
Languages Post #5502, on Sep 22, 2023 in TG

Rust's Safety Mob vs. C's Manual Memory Mayhem

Description

This is an object-labeling meme depicting a chaotic street scene. A large, agitated crowd is positioned on the right, above a man who is on the ground on a sloped, tiled embankment. White text with a black outline is superimposed over the image. The text over the crowd reads, "RUST USERS INSISTING HOW SAFE THEIR CODE IS." The text near the man on the ground reads, "C USERS MANUALLY USING MALLOC() AND FREE() ALL OVER THE PLACE." The meme humorously contrasts the two programming languages' approaches to memory management. It portrays the Rust community as a zealous, almost violent mob enforcing their language's core principle of memory safety, which is guaranteed at compile-time. In contrast, the C programmer, who must manually and carefully manage memory using functions like `malloc()` and `free()`, is shown as being overwhelmed and beleaguered, representing a practice often seen as dangerous and error-prone in modern systems programming

Comments

15
Anonymous ★ Top Pick A C programmer's favorite game is 'guess the pointer address,' while a Rust programmer's favorite game is 'argue with the borrow checker.' The outcomes are surprisingly similar: eventual frustration and a deep questioning of life choices
  1. Anonymous ★ Top Pick

    A C programmer's favorite game is 'guess the pointer address,' while a Rust programmer's favorite game is 'argue with the borrow checker.' The outcomes are surprisingly similar: eventual frustration and a deep questioning of life choices

  2. Anonymous

    Somewhere under that water-gun crossfire a lone pointer just went out-of-bounds - and Rust filed a compile-time restraining order

  3. Anonymous

    The real memory leak here is the cognitive overhead from explaining to your PM why rewriting everything in Rust will definitely fix that race condition that's actually caused by your distributed system's eventual consistency model

  4. Anonymous

    Rust developers pointing at C programmers manually managing memory is peak irony - until they realize they're just arguing about whether the compiler or the developer should be responsible for the inevitable segfault. At least C programmers know exactly which malloc() will haunt their 3 AM pager duty, while Rust devs spend three hours convincing the borrow checker that yes, they really do understand lifetimes this time

  5. Anonymous

    That wall is the borrow checker; the mob is dangling pointers - and the moment you cross the legacy C FFI, the ‘unsafe’ gate opens and malloc starts handing out pitchforks

  6. Anonymous

    Rust's borrow checker says "prove it"; C's malloc/free says "trust me," and the FFI boundary is where both lawyers settle out of court

  7. Anonymous

    Rust's borrow checker protests compile-time; C's malloc/free delivers runtime Russian roulette for pointer wranglers

  8. @callofvoid0 2y

    asm users manually accessing the memory

    1. @Araalith 2y

      You can't do this in protected mode.

      1. @SamsonovAnton 2y

        He probably meant something like calling vmalloc() or even alloc_pages() in Linux kernel, and then use the allocated pages in a completely unmanaged fashion.

      2. @Agent1378 2y

        Of course I can

  9. @Dark_Embrace 2y

    Zig users passing allocators all over the place to manually call alloc and free 🤪

  10. @Vlasoov 2y

    rust devs who purposely call Box::leak()

  11. @Araalith 2y

    And realloc ofc.

  12. @PeGa041 2y

    I'm outoftheloop, what's going on here?

Use J and K for navigation