Penguin
Annotated edit history of SIGSEGV version 8, including all changes. View license author blame.
Rev Author # Line
8 AristotlePagaltzis 1 !!! Signal: Segmentation Violation (SegmentationFault)
2 JohnMcPherson 2
3 This is raised when the program attempts has a bad memory reference such as:
6 AristotlePagaltzis 4
7 PerryLorier 5 * The pointer is NULL.
6 * Address not mapped to object (eg, the memory is unallocated, and unmapped by the OS)
2 JohnMcPherson 7 * Invalid Permission for mapped object (accessing memory that permissions deny).
3 JohnMcPherson 8
9 This is almost invariably a programming fault.
2 JohnMcPherson 10
11 The default action for this signal is to cause the program to terminate and dump core.
12
6 AristotlePagaltzis 13 A classic example is to dereference a pointer in [C] that is either uninitialised, or has already been freed. Here is some [C] code:
2 JohnMcPherson 14
8 AristotlePagaltzis 15 <verbatim>
16 #include <stdio.h>
17 int main(void) {
18 int *pointer;
2 JohnMcPherson 19
8 AristotlePagaltzis 20 pointer = 0;
4 JohnMcPherson 21
8 AristotlePagaltzis 22 printf("Value pointed to by pointer is %d\n",
23 *pointer /* this will cause SEGV */
24 );
25 }
26 </verbatim>
4 JohnMcPherson 27
8 AristotlePagaltzis 28 See CommonProgrammingBugs for hints on how to track down memory related bugs in the SourceCode.