r/C_Programming • • Mar 06 '26
Project My first Project: Making a Memory Arena. Looking for feedback.
Hello and thanks for coming by. I've been working on a project that makes use of an arena to allocate memory. When I first learned about arenas I really wanted it to become a library that can be used in any project with no hassle.
Since this is my first "proper" Project I've been looking for feedback and hoped I could gain some insight.
More notably I wish to get feedback on the structure of the project (not the source code specifically). I tried applying as much knowledge as I could, but now I feel like I need someone to review this project before I go any further.
https://codeberg.org/Racer911-1/Arena
And technically I've worked on other projects before that, but none of them were focused on the general layout of the project, just making it exist.
3
u/dfx_dj Mar 06 '26
Seems like a solid effort, well done.
Couple of nitpicks:
For
strdup, consider using regularmallocinstead ofcalloc, to avoid amemset(0)for memory that will be overwritten anyway. (The compiler may or may not optimise that away.)And, if I'm reading that right, chunk allocation size is always the aligned-up requested size plus the buffer size, which defaults to 64? This is a design choice of course, but to me this seems rather wasteful. If no allocation smaller than 64 is ever made, you basically end up with just a linked list of individual allocations, all of which are just a bit larger than necessary.
1
u/zimbabwe_zainab Mar 07 '26
How does codeberg compare to github? I heard it has bad storage limits or smth but that was a few months ago.