Should C compilers immediately free "further unused" memories? [closed]

I don’t know where you get your analysis from. Most parts like the abstract syntax tree is kept because it is used in all different passes.

It might be that some, especially simple compilers don’t free stuff because it’s not considered necessary for a C compiler. It’s a one shot compilation unit operation and than the process ends.

Of course if you build a compiler library like tinycc did you need to free everything, but even this might happen within a final custom heap clearance at the end of the compilation run.

I have not seen this ever be a problem in real world. But i don’t do embedded stuff where a lack of resources can be something to worry.

Leave a Comment