Re: will the memory allocated by malloc get released when program exits?



On Tue, 05 Jul 2005 15:54:07 -0700, Mark F. Haigh wrote:

>...

> Let's examine for a moment how one can come across a SIGSEGV:
>
> 1. Through undefined behavior leading to "an invalid access
> to storage" (C99 7.14#3), although such conditions are not
> required to be detected (C99 7.14#4).
>
> 2. As a result of calling raise (or other POSIX or system-
> specific functions, e.g. kill).

....

> Users of POSIX-compliant systems may be able to differentiate #1 from
> #2 via the si_code member of siginfo_t.

What's the point? If something causes a SIGSEGV using raise or POSIX kill
then presumably it wants the code to act as if a segmentation fault (or
whatever on the system causes it) had occurred. If it wanted it to act in
some other way it would make more sense to use a different signal.

Lawrence
.