From Jason Turner
Watch on YouTube

Summary

In this follow-up to previous PMR episodes, Jason addresses mistakes in his earlier allocator discussions. He clarifies terminology (memory resource vs. allocator) and demonstrates two significant PMR gotchas using a custom print_allocator that logs allocations. The episode reveals how initializer lists and vector::push_back() can cause unexpected allocations when used with PMR containers because initializer list elements are created with the default memory resource, not your custom one. Jason shows how to correctly build PMR-aware containers using a custom helper template function that reserves space and uses in-place construction.

Resources

Tags