5

Memory Management and Smart Pointers

Memory management can be defined as a process in which a computer’s memory is managed – for example, assigning memory to programs, variables, and more – so that it doesn’t affect the overall performance. Sometimes, the computer’s data can range up to terabytes, so efficiently using memory is necessary to minimize memory wastage and boost performance.

Memory management and smart pointers come at a price in C++. Programmers often complain about C++ because of its manual memory management requirements. While languages such as C# and Java use automatic memory management, it makes the programs run slower than their C++ counterparts. Manual memory management is often error-prone and unsafe. As we already saw ...

Get Expert C++ - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.