Should I free allocated memory on abnormal termination?

后端 未结 7 1613
無奈伤痛
無奈伤痛 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条回答
  •  梦毁少年i
    2021-01-17 12:53

    No. I think it's perfectly acceptable to simply throw up your hands and let the OS reclaim the memory after the program terminates. I think if this is truly an abnormal situation and the intention is to have the program terminate, then a well-behaved program should simply clean up any disk resources/locks, and exit as quickly as possible.

提交回复
热议问题