4 ms·
I don't know about more error prone. Benchmarks completely aside, freeing a batch of stuff you've allocated in a single place makes it easier to manage memory.
by boomlinde 7d ago
I don't know about more error prone. Benchmarks completely aside, freeing a batch of stuff you've allocated in a single place makes it easier to manage memory. I think it should be preferred wherever it's an option for that reason most of all. The "killer app" is something like an arena allocator that lives for the duration of an HTTP request.
- simonask 7d agoI respectfully disagree. The technique has its place, and I use it once in a while, but whether it makes a positive difference for performance is highly sensitive to a number of factors. For example, bump style allocators allocate very quickly, but at the cost of higher memory usage and therefore sometimes worse cache locality. The only way to know is to actually measure.
- boomlinde 7d agoYou disagree with a point I never made. My point is that they enable easier memory management, regardless of whether they're more performant. I really don't understand how that point didn't get across. You must simply not have read what you responded to.
- simonask 6d agoYou said > I think it should be preferred wherever it's an option for that reason most of all. And that’s far too broad in my opinion. Sure, if you’re writing in a language that makes memory management difficult, like C or Zig, that might be worth it, but arena allocators apply to many other languages too.
- deleted 5d ago[deleted]
- boomlinde 5d ago> You said Yes, which you didn't respond to until now. > And that’s far too broad in my opinion. Similarly, it's far too broad to say that it's "much less error prone" to use a more general allocation strategy. Clearly we both make unspoken assumptions, but in the context of this discussion on Zig, where you initially responded to an example written in Zig, I think you actually understood what I meant.