How is dynamically allocated space freed when a program is interrupted using Ctrl-C?

前端 未结 4 852
遇见更好的自我
遇见更好的自我 2020-12-17 21:12

Given the following code:

#include 

int main()
{
    int *p;
    p = (int *)malloc(10 * sizeof(int));

    while(1);
    return 0;
}
<         


        
4条回答
  •  独厮守ぢ
    2020-12-17 21:43

    The full explanation of _exit is here:

    http://pubs.opengroup.org/onlinepubs/9699919799/functions/_Exit.html

    The same things happen when a process terminates as a result of a fatal signal.

提交回复
热议问题