> Last but not least, chibicc allocates memory using calloc but never calls free. Allocated heap memory is not freed until the process exits. I'm sure that this memory management policy (or lack thereof) looks very odd, but it makes sense for short-lived programs such as compilers.
I’ve thought about this – why isn’t this a more common thing to do for short-lived programs such as cli programs? Or is it common – could anyone give some examples of well-used programs that do this?
The reasons to not do it that I could think of is:
1. “It’s just bad practice”
2. You may suddenly find yourself having written some kind of malloc bomb, more easily than you think
I’ve thought about this – why isn’t this a more common thing to do for short-lived programs such as cli programs? Or is it common – could anyone give some examples of well-used programs that do this?
The reasons to not do it that I could think of is:
1. “It’s just bad practice”
2. You may suddenly find yourself having written some kind of malloc bomb, more easily than you think