Taming Dynamic Memory - An Introduction to Custom Allocators
summary
Explains how a monotonic allocator gives O(1) allocate, only bulk reset (example: reset a 42‑byte buffer) and avoids external fragmentation but loses per-allocation frees; shows pool allocator tradeoffs (chunk size vs internal fragmentation, diffusion of free list) and how a multi‑pool reduces worst‑case waste. Demonstrates std::pmr polymorphic memory_resource, builtins like new_delete_resource and synchronized/unsynchronized pools, and chaining upstream resource behavior for fallback and profiling hooks. Practical advice: measure, reserve for vectors, and prefer special allocators for known lifetimes.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:08Problems with global allocators
- 8:07Monotonic allocators
- 12:36Use cases and benefits
- 19:02STL containers and strategies
- 26:30Extending allocation logic
- 28:49Padding and alignment
- 38:50Dangers of over-engineering
- 43:07Pool allocators
- 50:55Multi-pool allocators
- 1:00:16C++ PMR library support
- 1:13:58Summary and conclusions
related talks
01h 03mMost Malleable Memory Management Method
49mMost Malleable Memory Management Method in C++
01h 01mAllocators: The Good Parts
01h 01mGetting Allocators out of Our Way
01h 04mHow to Write a Custom Allocator
01h 11mDynamic Memory Allocation Challenges in C++ Safety Critical Systems
27m“From security to performance to GPU programming..."
57m“An allocator model for std2”
