4 ms·
What if the function does more than a single allocation? Imagine a library like libxml2 that can parse a whole XML document into a DOM tree. In many cases you i
by planede 3y ago
What if the function does more than a single allocation? Imagine a library like libxml2 that can parse a whole XML document into a DOM tree. In many cases you it would be nice to just pass an arena allocator and throw away the whole DOM in one go. Unfortunately libxml2's allocator customization kinda sucks and it's not easy to do.
- charcircuit 3y agoYou can still do something like the original article describes.
- planede 3y agoSure, that's what I was getting at. Being able to pass stateful allocators as function arguments is very flexible.