~/talk

An Allocator is a Handle to a Heap

Talkat CppCon 2018 · 2018-09-23..09-28· [software-architecture]
slides:none on file

Claim: an allocator is not a heap but a cheap handle to a heap: std::pmr::polymorphic_allocator holds a pointer to a std::pmr::memory_resource and copying the allocator copies the handle not the memory. Demonstrated failure of an allocator-that-contains-its-own-buffer (dangling pointers), the working model using std::pmr::polymorphic_allocator and memory_resource, and consequences: allocators must be rebindable family, cheaply copyable, move-from must preserve value. Notable specifics: stateless std::allocator uses zero-bit stateless allocator semantics; one‑byte indexing hack for small resource tables is possible.

AI-written summary · about

  1. 0:00Intro
  2. 1:03Outline
  3. 1:31What is an object?
  4. 5:49What is a (sequence) container?
  5. 7:14What is an allocator?
  6. 8:51What goes into an allocator?
  7. 10:58std::pmr:: polymorphic_allocator
  8. 19:00Standard new_delete_resource()
  9. 27:03Corollaries to the new way of thinking
  10. 28:17Allocators must be "copy-only" types
  11. 34:13Allocators are "rebindable family" types
  12. 43:30Allocator source of memory
  13. 44:57Container uses pointer for all allocations
  14. 46:31Fancy pointers' range = raw pointers' range
  15. 47:05So are fancy pointers just native pointers?
  16. 50:39A C++ allocator is...
  17. 57:49Truly polymorphic allocator
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.