January 19, 2026
Who owns this chaos?
Understanding C++ Ownership System
Who cleans up in C++? Devs bicker as Rust jokes fly and 'never use new' crowd piles in
TLDR: A guide explains how C++ makes you manage your own memory, pushing concepts like RAII to avoid bugs. Commenters brawled over “never use new/delete,” arenas vs. smart pointers, a Rust jab, and a tiny delete[] fix—proof that memory ownership is both essential and endlessly controversial
A brave soul tried to explain who “owns” objects in C++—aka who cleans up the mess when you’re done—and the internet turned it into a comedy roast and custody battle. The post walks through the basics: in C++ there’s no garbage collector (automatic clean‑up), so you need ownership, references, and RAII (Resource Acquisition Is Initialization) to keep memory from exploding. It even calls out the classic mystery function that returns a string but won’t say who’s supposed to throw out the trash.<br><br>Then the comments kicked in. Dwedit delivered a horror trailer: “accidentally deallocate an object that’s still in the call stack”—translation: your program eats itself. Meanwhile, jesse__ lit a flare asking for resources that ditch smart pointers and RAII in favor of bulk allocations and arenas, calling the traditional model “hot garbage.” Cue a philosophy fight between the “RAII is life” crowd and the “give me arenas and freelists” performance maximalists.<br><br>jurschreuder scolded everyone: stop teaching new/delete, real C++ barely uses them—objects clean up when they go out of scope. Then einpoklum brought popcorn with a Rust quip and a video, while dpsych quietly fixed a code typo (delete the old buffer, not the new one). The vibe: C++ memory rules are vital—and divisive—yet still meme-worthy
Key Points
- •The article defines C++ ownership as responsibility for creating, destroying, borrowing, and transferring objects.
- •It presents two ownership scenarios for a function returning a char*, showing how cleanup responsibility varies.
- •C++ lacks a garbage collector; instead, RAII and destructors handle automatic resource cleanup at scope end.
- •Variables own objects they declare; destructors define lifetimes and ensure cleanup when scope ends.
- •A manual new/delete example demonstrates exception-safe cleanup challenges, reinforcing RAII as preferred.