In Ubuntu I have faced the segmentation fault error many times. What is a segmentation fault and when does it occur?
An error saying segmentation fault (or segfault, or SIGSEGV) in Ubuntu and other Unix-like operating systems, or saying general protection fault in Windows, is when a program attempts to access a part of memory that cannot be accessed, or which the program is prohibited from accessing. A segmentation fault is a kind of program crash, that is, an abnormal termination of a program. See the Wikipedia articles on crashes, memory protection, segmentation fault, general protection fault, and SIGSEGV for more information (and a more textured understanding of the topic than is presented here).
A segmentation fault is almost always due to a bug in the program where it occurs. I am guessing most or all of your segmentation faults are happening from the same application. Please provide more details about the circumstances under which segmentation faults are happening on your machine, and what program is crashing. Please also provide the full and exact text of the error message you're receiving and any other messages that appear before it. This should make it possible for us to provide detailed advice specific to your problem (rather than just general information about what a segmentation fault is).
The best way for you to provide this information is for you to edit your question to include it. Alternatively, if you want this question to be just about segmentation faults in general, you could post a new question to ask about what specifically is causing your segmentation faults (if you do this, make sure to provide all these details in your new question).
Segmentation fault is caused by a bug in the application. Technically it means that application try to read or write to part of memory that doesn't belongs to it (or doesn't exist). It's of course forbidden to read or write to somebody else's memory and when system (kernel) detects this, it will force the application to quit.
Gone are the days when people used to trace through assembly code and debug a problem. Abends, Dr Watson, Segmentation fault. Those green days are gone.
One of the reasons for a segmentation fault is when code that has direct access to memory fails. When a piece of code tries to access the memory segment of a different application, segmentation fault occurs. Memory allocations are some times moved around to allow larger contiguous blocks of memory to get allocated. While it tries to recover, the kernel tries hard to save all its memory information to a file, current state of all applications running on the cpu and their state (last instruction run) to a file and just die. It will also try to store as much recovery information, and close as many files as it can, so that hdd's dont get broken links.
Debug it and fix it if you can reproduce it often. If you cannot reproduce it, just join your hands, kneel down and pray like hell that you don't see it "regularly".
protected by Community♦ Apr 4 '13 at 2:25
Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?