does exit() free allocated memory on both _SUCCESS and _FAILURE

前端 未结 4 2733
旧时难觅i
旧时难觅i 2021-02-19 16:43

This a short snippet of code, with two calls to exit(3) in case of failure. Do these calls deallocate memory allocated by malloc? Google search once says it does, a

4条回答
  •  没有蜡笔的小新
    2021-02-19 17:26

    After calling exit you're beyond malloc and friends but the OS reclaims everything. Think of malloc as a convenient intermediary between the OS and your process.

提交回复
热议问题