Differences between version 6 and previous revision of SIGSEGV.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 6 | Last edited on Friday, June 4, 2004 7:19:17 am | by AristotlePagaltzis | Revert |
Older page: | version 5 | Last edited on Friday, June 4, 2004 4:59:14 am | by AdamLamb | Revert |
@@ -1,24 +1,25 @@
!!!Signal: Segmentation Violation (Fault)
This is raised when the program attempts has a bad memory reference such as:
+
* Address not mapped to object (accessing memory that isn't mapped)
* Invalid Permission for mapped object (accessing memory that permissions deny).
This is almost invariably a programming fault.
The default action for this signal is to cause the program to terminate and dump core.
-A classic example is to dereference a pointer in [C] that is either uninitialised, or has already been freed. Here is some C code:
+A classic example is to dereference a pointer in [C] that is either uninitialised, or has already been freed. Here is some [
C]
code:
#include <stdio.h>
int main(void) {
int *pointer;
- pointer=;
-
- printf("value pointed to by pointer is %d\n",
- *pointer /* this will cause SEGV */
- )
;
+ pointer = ;
+ printf("Value pointed to by pointer is %d\n",
+ *pointer /* this will cause SEGV */
+ );
+ }
See CommonProgrammingBugs for hints on how to track down memory related bugs in the source code.