CppCon 2016: Herb Sutter “Leak-Freedom in C++... By Default.”
Channel:CppCon · Length:1:39:25 · Published:2016-09-26 · Views:149280
Summary
Herb Sutter's CppCon 2016 talk on lifetime safety in C++, aiming for code free of leaks and dangling pointers by default. It covers smart pointers, ownership, reference counting pitfalls and deferred reclamation resembling garbage collection.
Why HN recommends it
HN cites it in memory management debates for its treatment of reference counting problems, destructor stack overflows and deferred pointers.
Check all of Herb Sutter's CppCon videos from 2015-2016, especially this one — HN, 2016
C, C++, Rust, Go & systems languages
Subtitles (excerpt)
first of all thank you everybody for coming to this conference we had record attendance again this year it has been a blast I've heard from many of you how much you've enjoyed all the Keynotes and plenaries all the sessions so I'm going to try very hard not to let you down here near the end we're going to talk about leak freedom in C++ and we're not actually all that used to leaks in modern c+s because we know how to have objects own things but it's worth putting in one place for two reasons first of all I would like there to be a talk that people can link to that says yeah this is how you do it in C++ that seems relatively simple so we're going to start with the rules on one slide but then goes through example after example of how to apply them and acknowledge where we still need to be aware of issues and how to resolve them so that's how we're going to progress through the talk this is related to last year because last year be strip gave a a great introduction to the C++ core guidelines I specifically gave a talk that was on half of Lifetime safety about dangling pointers and we're still very interested in that we're in the process of writing down the formal specification rules so those can be implemented in analyzers
On Hacker News
Check all of Herb Sutter's CppCon videos from 2015-2016, especially this one: [VIDEO] He does a great job of walking through the thought process of deciding which of the options makes sense in different situations. — shermanyo, 2016-09
On single core without threading. If you add multi-threading and multi-core, there is lock contention for every single memory access to update the related counter. Additionally, if there is a big data structure in use, reaching zero will trigger a cascade deletion events reaching stop-the-world like effect. Which, depending on how the deletion was implemented, might trigger a stack overflow in ve… — pjmlp, 2020-01
Herb Sutter has a nice talk about how RAII can cause stack overflows or stop-the-world pauses if used badly. [VIDEO] — pjmlp, 2019-01
Reference counting isn't deterministic in the presence of large complex data structures. You will know when memory gets deleted, but not how long it will take, nor how much stack space the destructors will require to run. Enjoy Herb Sutter's "Leak-Freedom in C++... By Default." at CppCon 2016, where he explains how those issues affect C++ and goes on to implement a tracing GC. [VIDEO] — pjmlp, 2017-08
Herb Sutter gave a really great talk on this: [VIDEO] He has 3 guidelines: 1. Prefer scoped lifetimes by default (local members) 2. Else prefer unique_ptr and containers 3. Else consider shared_ptr His whole talk gives examples that show the flexibility of unique_ptr and how modern C++ can express ownership. See slide 5 here: [LINK] — shermanyo, 2016-09
Related videos
- CppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++” · CppCon · 1:00:07
- CppCon 2014: Herb Sutter "Back to the Basics! Essentials of Modern C++ Style" · CppCon · 1:40:26
- CppCon 2015: Kate Gregory “Stop Teaching C" · CppCon · 1:00:11
- Edwin Brady - Idris 2 - Type-driven Development of Idris · Curry On! · 40:38
- Eric Bier Demonstrates Cedar · Computer History Museum · 1:56:07
- CppCon 2016: Dan Saks “extern c: Talking to C Programmers about C++” · CppCon · 1:36:26
- "A Political History of X" - Keith Packard (LCA 2020) · linux.conf.au · 45:33
- RailsConf 09: Robert Martin, "What Killed Smalltalk Could K · O'Reilly · 1:00:55
- CppCon 2017: Kate Gregory “10 Core Guidelines You Need to Start Using Now” · CppCon · 1:02:33
- CppCon 2015: Herb Sutter "Writing Good C++14... By Default" · CppCon · 1:29:05
- Yesterday's Computer of Tomorrow: The Xerox Alto │Smalltalk-76 Demo · Computer History Museum · 16:48
- SYMBOLICS S-PACKAGES 3D GRAPHICS AND ANIMATION DEMO · Red Martian · 29:16
- Alto System Project: Dan Ingalls demonstrates Smalltalk · Computer History Museum · 2:08:02
- Alan Kay's tribute to Ted Nelson at "Intertwingled" Festival · TheTedNelson · 17:33
- Introducing a Memory-Safe Successor Language in Large C++ Code Bases - John McCall - CppNow 2023 · CppNow · 1:22:20
- A Narrative History of BSD, Dr. Kirk McKusick · bsdconferences · 53:54