Skip to content
Tech News
← Back to articles

Bjarne Stroustrup: How do I deal with memory leaks? (2022)

read original get Memory Leak Detection Tool → more articles
Why This Matters

Bjarne Stroustrup emphasizes the importance of understanding and managing memory leaks in C++, a critical aspect for developing reliable and efficient software. His insights help developers improve their coding practices, leading to more robust applications and better resource management in the tech industry. This guidance is especially valuable as C++ remains a foundational language for system-level and performance-critical software.

Key Takeaways

Bjarne Stroustrup's C++ Style and Technique FAQ

Modified February 26, 2022

These are questions about C++ Style and Technique that people ask me often. If you have better questions or comments on the answers, feel free to email me (bs at cs dot tamu dot edu). Please remember that I can't spend all of my time improving my homepages.

I have contributed to the new, unified, isocpp.org C++ FAQ maintained by The C++ Foundation of which I am a director. The maintenance of this FAQ is likely to become increasingly sporadic.

Also, the C++ Core Guidelines contains a large set of maintained guidelines for the use of modern C++.

For more general questions, see my general FAQ.

For terminology and concepts, see my C++ glossary.

Please note that these are just a collection of questions and answers. They are not a substitute for a carefully selected sequence of examples and explanations as you would find in a good textbook. Nor do they offer detailed and precise specifications as you would find in a reference manual or the standard. See The Design and Evolution of C++ for questions related to the design of C++. See The C++ Programming Language for questions about the use of C++ and its standard library.

Translations:

#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<double> v; double d; while(cin>>d) v.push_back(d); // read elements if (!cin.eof()) { // check if input failed cerr << "format error

... continue reading