Comment by lelanthran

3 months ago

>If you aren't preallocating and just using arenas for to free in a group, then I'm going to say using an arena for stuff that is going to be freed by the OS at program exit is adding complexity for no benefit

What makes you think that the program is going to exit anytime soon?

Arenas are useful if you want to execute a complex workflow and when it is over just blow away all the memory it accumulated.

An HTTP server is the textbook example; one arena per request, all memory freed when the request is completed, but there's many many more similar workflows in a running program.

Leaving it for program exit is a luxury only available to those writing toy programs.

> What makes you think that the program is going to exit anytime soon?

Because freeing memory in multiple exit paths of a short-running program is the definition of the problem he's trying to solve. Read what I posted before you waste everyone's time with another ego-based response where you don't admit you missed that important detail.

I'm well aware of what arenas are and they're an excellent tool for a lot of situations, maybe even most situations, but this isn't one of those situations.

Also be sure to let the authors of grep know their program used by millions of people is a toy program.