My favourite memory leak
summary
Claim: a leak happens without calling new by exploiting a recursively nested std::vector: a type V holds vector<V> children, creating one child and then swapping the parent with that child. Swap merely exchanges buffer pointers (swap pointers), producing a self‑owning structure that leaves an orphaned element whose heap buffer is unreachable when a scope ends. The concrete build uses std::vector internals and a single emplace_back so the surprising count is one leaked buffer.
AI-written summary · about
related talks
01h 52mThe evolving search for effective C++ - Keynote
58mThere is no silver bullet
40mC++ for C Developers
01h 31mLearning from C++ Juniors’ Mistakes
40mMigration from C to C++
02h 02mBelle Views on C++ Ranges, their Details and the Devil
07mLightning Talk: Filling the Bucket: Reading Code, C++ Code Interviews & Exams
01h 01mDown the Rabbit Hole: An Exploration of Stack Overflow Questions
