Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am not a C programmer but I will try!

Malloc/free - can turn into a tangled mess as you need to keep symmetry, and apps might have complex dep. graphs

Stack - wonderfully simple but often if you need to share things across the depths of your program you need to define variables in shallower parts - but you won’t know how much is needed ahead of time. Example a parsing library.

Arena - like a single malloc / free with it’s own stack. Use this to allocate memory for objects that can be all freed at the same time (if they need to be freed at all). No need to malloc for each object.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: