In this chapter, we learned various ways to allocate memory using new() and delete() and malloc() and free(), including aligned memory and C-style arrays. We looked at the difference between global memory (memory in the global space), stack memory (or scoped memory), and dynamically-allocated memory (memory that is allocated using new() and delete()). The safety concerns of new() and delete() were also discussed, and we demonstrated how C++ smart pointers, including std::shared_ptr{} and std::unique_ptr{}, may be used to prevent common instability issues in programs, and how they provide C++ Core Guidance support. We concluded this chapter with a quick review of fragmentation and how it can affect system programs.
In the next chapter, we will cover file inputer and output including read and writing to a file, and the filesystem APIs that were added by C++17.
...