CppCon 2016: Sergey Zubkov “Examining applications that do not terminate on std::bad_alloc"

Play CppCon 2016: Sergey Zubkov “Examining applications that do not terminate on std::bad_alloc"
Sign in to queue


Published on Oct 5, 2016

Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/cppcon/cppcon2016

System memory holds a special place in the hierarchy of program resources; its availability is the implied precondition for many innocuous lines of code, from std::string::substr() to passing std::function<> by value. The ability to always create another object is ingrained in the OOP mindset so much that it is often said that immediate termination is the cleanest way to handle memory allocation failures in most situations. Nevertheless, C++, when consistently applying RAII, makes it possible to treat memory allocation exactly as any other resource acquisition.
To what degree do actual applications take advantage of that possibility and what responses to allocation failures are there in the wild? This presentation will examine over 300 open source projects that incorporate explicit handling for std::bad_alloc, examine the causes (it's not always "out of memory"), response strategies (it's more than just rollback), and related practical considerations.

Sergey Zubkov
Morgan Stanley
Sergey is a former biochemistry researcher and OS developer, who now works in finance and spends his free time editing cppreference.com

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com





Download this episode

The Discussion

Add Your 2 Cents