Should I free allocated memory on abnormal termination?

后端 未结 7 1610
無奈伤痛
無奈伤痛 2021-01-17 12:34

My program (a text-mode web browser) is dynamically allocating memory.

I do free unneeded blocks during runtime, of course. And I do free everything before normal te

7条回答
  •  不思量自难忘°
    2021-01-17 13:00

    No, unless your program always terminates abnormally. :) Anyway, the OS does a fine job freeing it up. In fact many lazy programmers don't even bother freeing things up with normal termination - but this makes detecting other memory leaks difficult (the ones that are a real problem).

提交回复
热议问题