is not cleaned up, assert actually does not return , and the program is immediately interrupted. After the program is interrupted, the operating system reclaims all resources of this process. In the severe case of the operating system, it is not possible to distinguish between a and What the hell is "wrong here"? It's just a piece of memory.
function are all local variables, and the memory of the variable is allocated on the stack. For a,b, the memory of the variable is allocated at the beginning. If you exit normally from the main function, then Normal release. If you exit abnormally directly, there is no need to clean up. . You can see the difference between exit,return and other functions to exit the program. .
is not cleaned up, assert actually does not return , and the program is immediately interrupted. After the program is interrupted, the operating system reclaims all resources of this process. In the severe case of the operating system, it is not possible to distinguish between a and What the hell is "wrong here"? It's just a piece of memory.
The variables within the
function are all local variables, and the memory of the variable is allocated on the stack. For
a,b
, the memory of the variable is allocated at the beginning. If you exit normally from themain
function, then Normal release. If you exit abnormally directly, there is no need to clean up. .You can see the difference between
exit,return
and other functions to exit the program. .The operating system directly reclaims the memory used by this program.