Dynamic Memory Allocation Challenges in C++ Safety Critical Systems
summary
Covers why ISO 26262 and guidelines like MISRA 2023 ban or restrict heap use and what actually breaks: leaks, out‑of‑memory, allocation/deallocation mismatch, fragmentation, non‑deterministic latency and use‑after‑free. Shows concrete surprises: stack grew from 132KB to 632KB during recursion and stays expanded, malloc sometimes returns memory via mmap instead of brk so extra segments appear, make_unique<int> costs 4 bytes but shared control blocks can be ~24 bytes, threads/promises allocate (~24–48 bytes). Maps options: global/class operator new override, custom allocators, std::pmr memory_resource (monotonic, null, new_delete) and their propagation and swap pitfalls.
AI-written summary · about
chapters (21)
- 0:00Dynamic memory in safety critical
- 1:55Safety critical systems defined
- 5:47ISO 26262 overview
- 8:17ISO 26262 requirements
- 11:50Avoid dynamic memory in C++
- 14:01Programs and memory changes
- 20:05Linux executable memory layout
- 21:57Linux memory segments
- 23:00Stack growth in recursion
- 25:57Heap allocation behavior
- 31:42Hardware cache misses
- 33:10C++ memory model
- 36:43C++ new and delete deep dive
- 47:12Dynamic memory in C++ standard library
- 53:37Detecting alloc in libraries
- 56:48Global memory customization
- 59:22Class-specific allocators
- 1:00:46Custom allocators traits
- 1:02:53Polymorphic memory resources
- 1:07:30Challenges and pitfalls
- 1:10:39Q&A
related talks
01h 25mTaming Dynamic Memory - An Introduction to Custom Allocators
49mMost Malleable Memory Management Method in C++
01h 01mRecipes for Reducing Allocations by C++ Containers
01h 03mMost Malleable Memory Management Method
01h 01mAllocators: The Good Parts
01h 23mElsewhere Memory (C++20 Abstract Machine) + Virtual Memory
01h 04mHow to Write a Custom Allocator
01h 01mGetting Allocators out of Our Way
