Memory turns out to be one of the core concepts when dealing with systems development. Allocating, freeing, and learning how memory is managed, and knowing what C++ can offer to simplify and manage memory, are crucial. This chapter will help you grasp how memory works by learning how to use C++ smart pointers, aligned memory, memory-mapped I/O, and allocators.
This chapter will cover the following topics:
- Learning automatic versus dynamic memory
- Learning when to use unique_ptr, and the implications for size
- Learning when to use shared_ptr, and the implications for size
- Allocating aligned memory
- Checking whether the memory allocated is aligned
- Dealing with memory-mapped I/O
- Dealing with allocators hands-on