English
Topic 5. Pointers, references and memory management: the new and delete operators, smart pointers
Goal: learn to distinguish owners from observers; implement linked structures; check buffer bounds and find memory errors
Lecture contents
- Memory and pointers — Memory, objects and storage duration · Pointers and access operations · Arrays and pointer arithmetic
- Dynamic memory and its errors — Manual dynamic memory · Memory errors and diagnostics
- Smart pointers — unique_ptr: a single responsible owner · shared_ptr and weak_ptr · A linked list with exclusive ownership
- Ownership models and span — A non-owning interface and span · Choosing an ownership model · Analyzing an ownership graph in concrete scenarios
- Diagnostic experiments — A buffer experiment: before and after release · How to run a diagnostic experiment · Removing a node without breaking the chain