Hey guys,
After expanding a program I wrote a couple of months ago and finding the memory cleaning section unsightly -bunch of flags and conditions to determine what I must and mustn't free- I stumbled upon the idea of using a “free list”; a list in which I store all the pointers that must be freed by the end of the program, those that must persist throughout its life. All temporary allocations that can be, are freed after use and are not included in this list.
I have to say I’ve never seen this concept before, but then again, I haven’t read many real world, programs. As far as I know this might be a common thing or regarded as evil as global variables.
Personally, I don’t see nothing wrong with it, but there could be pitfalls I’m not thinking of. What do guys think?