Embedded: Customizing Dynamic Memory Management in C++
summary
Shows how to replace global and per-type allocation by defining class-specific operator new and matching deletes, including the no-throw overload, and how the compiler pairs new/delete when constructors throw. Demonstrates a simple fixed-size free list allocator: a static array of same-size blocks linked at startup, O(1) alloc/free, deterministic and fragmentation-free for that type. Covers alignment via alignof and unions, array new/delete caveats, and a tiny leak counter example.
AI-written summary · about
chapters (30)
- 0:00Introduction
- 2:58Storage duration types
- 6:21New and delete mechanics
- 8:28Compiler generated code
- 10:38Checking for null pointers
- 12:06Operator new and delete
- 13:55Replacing operators
- 16:07Custom tracking allocator
- 18:21Multiple operator versions
- 20:08Arguments to operators
- 22:11Global manager challenges
- 25:15Pool allocator strategy
- 27:35Class specific operators
- 29:42Inheritance considerations
- 31:07Static member functions
- 32:37Memory resource use
- 34:28Virtual destructor roles
- 36:02Pool allocator implementation
- 37:47Deterministic performance
- 39:45Managing available blocks
- 42:01Storage alignment issues
- 44:00Modern alignment techniques
- 46:14Pointer casting
- 47:20Array allocation
- 48:50Array management challenges
- 50:44Exception handling in embedded
- 51:53No throw operators
- 53:44Safe exception handling
- 55:52Operator pairing
- 57:46Conclusion
related talks
38mDynamic Data Structures and Memory Management on GPUs
50mHow the Environment Changes the Way We Write C++ Code
01h 11mC++ in the World of Embedded Systems
25mBridging the Memory Hotness Gap in Edge Systems with Hotness-Segregated Object Allocation
52mC++ for Embedded Development
01h 03mFreestanding C++ - Past, Present, and Future
22mAwesome API Design
01mC++ On Sea 2024 Preview: How to keep your binaries small?
