Segmentation Fault

What Does Segmentation Fault Mean?

A segmentation fault (segfault) is an error returned by hardware with memory protection that tells the operating system that a memory access violation has occurred. The operating system usually reacts by telling the offending process about the error through a signal and then the OS performs some sort of corrective action. This happens because a process or program tries to access memory that is not assigned to it.


A segmentation fault is also known as an access violation.

Techopedia Explains Segmentation Fault

A segmentation fault is often caused by errors in the programming of a process or application in which the program is led to access memory that was not allocated for it but for other programs or for the system itself. A process is not allowed to touch memory not reserved for it, as it must always request memory before using it. Therefore, when it accidentally touches memory that is not assigned to it, an access violation occurs.

Segfaults can also be caused by a recursive function, which can use up all of the stack space it is assigned and quickly encroach on memory not assigned to it. In some systems, this is considered a stack overflow, but for others it is simply a kind of access violation.

A segmentation fault can be handled by a process through a custom signal handler, but often it is the OS’s default signal handler that is used, which usually results in the offending process being terminated abnormally, called a crash, or the OS forcing a core dump.


Related Terms

Margaret Rouse

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.