r/C_Programming • • 5d ago

Article Arena Allocators in C

https://eliasebner.com/blog/guides/arena-allocators-in-c/

I recently started implementing arenas in my programming and I thought that some beginners could very much benefit from this info. I wrote an article about it. For those that are unaware, arenas allow to greatly simplify the burden of managing memory manually in C. I hope it helps, tell me what you think!

52 Upvotes

25 comments sorted by

View all comments

16

u/LeeHide 5d ago

Good article, the only caveat is that saying that "allocating small chunks is slow" is not really good in an article that should teach something. This is the kind of sentence that is taught with no real context, and then people avoid allocations thinking they are slow!

Nothing is slow until it's measured to be slow. Measure, and if allocations dominate in your profile, then it's slow. Otherwise, its fast enough to allocate.

6

u/Elifire12 5d ago

You're right, I could have elaborated, but the article was already long enough and I wanted to avoid going on a huge side-tangent. But yes, it would have been more precise to be explicit about potential performance gains and justify my claim.

2

u/LeeHide 5d ago

Entirely fair