Good videos, with context.
CppCon 2015: Andrei Alexandrescu “std::allocator...”

CppCon 2015: Andrei Alexandrescu “std::allocator...”

CppCon
7 HN recommenders · discussed 2017–2025
Open YouTube ↗

About this video

Andrei Alexandrescu's CppCon 2015 talk argues that std::allocator is badly designed. He proposes building high-performance allocators from small composable, templated pieces.

Why it appears in the archive

HN repeatedly recommends it as an entertaining, mind-opening talk on allocator design and composable generic programming.

AI-generated summary and labels from the source dataset; verify important details against the video. Source & credits.

From the Hacker News discussion

nly · 2017-05 · strong rec

Actually it is C's malloc and free that is "broken". malloc() takes a size parameter, but free() doesn't. This imbalance means it can never be maximally efficient. Whatever GNU stdlibc++ is doing is probably, on balance, a net win for most programs. It's not exactly roses in C++ either of course. You can do better than the standard library facilities. Andrei Alexandrescu gave a great, entertaining, and technically elegant talk on memory allocation in C and C++ at Cppcon 2015 that is well worth watching [VIDEO]

Read original comment ↗
p0nce · 2018-12 · strong rec

> I would have liked to hear more about what exactly made D so great This WIP article explains very well the USP of D: [LINK] (section 3) This article highlight the value of "design-by-introspection" applied to a particular problem space: [LINK] This talk present a concrete example of such: [VIDEO] (mind bending stuff) You might not understand what is new about it, but soon your competitors will understand it.

Read original comment ↗
favorited · 2020-04 · strong rec

A bit unrelated, but if anyone is interested, I recently watched Andrei Alexandrescu's 2015 talk about a composable allocator design in C++ and it was really interesting. And Andrei's presentation style was fantastic, per usual. Note that this talk is about a std::allocator-like type, potentially on top of one of malloc/jemalloc/etc. [VIDEO]

Read original comment ↗
favorited · 2020-10 · strong rec

Andrei Alexandrescu's 2015 talk about C++'s allocators is great. He's a very entertaining presenter, and he makes case for extremely composable templated allocators (and why std::allocator isn't that). [VIDEO]

Read original comment ↗
jiggawatts · 2020-12 · strong rec

Every time I hear someone talking about writing a memory allocator, it always reminds me of the brilliant CppCon 2015 talk by Andrei Alexandrescu about how he wrote an modular allocator library that can be built up in pieces to make whatever you like. [VIDEO]

Read original comment ↗
jiggawatts · 2023-01 · strong rec

Not exactly a lecture series, but Andrei Alexandrescu has had some fantastic keynote presentations at CppCon. I don't even program in C++ any more, but I've watched these more than once, they're entertaining, approachable, and inspiring: Speed Is Found In The Minds of People [LINK] std::allocator Is to Allocation what std::vector Is to Vexation [VIDEO] An actual lecture series I've enjoyed watching is "The WE-Heraeus International Winter School on Gravity and Light", which covers General Relativity using modern mathematical approaches: [LINK] Again, I haven't done physics in 20 years, but I've found it surprisingly easy to follow because it is so clearly presented.

Read original comment ↗
jiggawatts · 2025-01 · strong rec

> The issue with this approach is that the more you can control, the less the compiler can assume. That's absolutely true, but there's a workaround, albeit a complicated one. The compiler internals need the same kind of constraints or traits that abstract code such as language interfaces or template parameters can have. These can then be used to constrain the internals in a way that then would allow assumptions to be safely "plumbed through" the various layers. The (big!) challenge here is that these abstractions haven't been well-developed in the industry. Certainly nowhere near as well as the typical runtime "type theory" as seen in modern languages. > some very basic ones like allocating heap memory. Well... this is sort-of my point! For example, what's the fundamental difference between allocating memory in some heap[1] structure at runtime and a compiler allocating members in a struct/record/class for optimal packing? IMHO, not much. E.g.: Watch this talk by Andrei Alexandrescu titled "std::allocator Is to Allocation what std::vector Is to Vexation": [VIDEO] It really opened my eyes to how one could very elegantly make a very complex and high-performance heap allocator from trivial parts composed at compile-time. There's no reason that a nearly identical abstraction couldn't also be used to efficiently "bin pack" variables into a struct. E.g.: accounting for alignment, collecting like-sized items into contiguous sections, extra padding for "lock" objects to prevent cache

Read original comment ↗
badsectoracula · 2017-06 · rec

Generally speaking many C++ game engines avoid the STL stuff and reimplement their own more predictable containers, often with custom allocation schemes. The engine at the last game company i worked at, for example, had its own containers and memory allocator and allowed you to define the allocation category and pool per allocator and per object class (so, e.g., dynamic strings would be isolated to their own pool to avoid fragmenting the heap). Related, Andrei Alexandrescu had a great talk about allocators in C++ a couple of years ago: [VIDEO] Also related to the Orthodox C++, the same engine also ousted exceptions and RTTI. I'm not sure about the reason for exceptions, but C++'s RTTI was simply inadequate and instead it was replaced with a custom one made using macros (similarly to wxWidgets and MFC) that allowed automatic object serialization and reflection which was used for all saving and loading, exposing objects to the editor automatically with a common UI and exposing classes and objects to the (custom) scripting language with very little setup. Interestingly most of the stuff the engine had to reinvent seem to be first class citizens in the D language. Also Andrei's allocators also seem to be available (experimentally) there too. Personally i prefer plain old C (C89 even, although with a few commonly available or easily reproducible extras like stdint) because i see C++ as too complex for what it is worth. However D seems to provide more power with less complexity and

Read original comment ↗