Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-28-2003, 07:01 AM   #1
Registered: Jul 2003
Location: Osaka, Japan
Distribution: Arch, Ubuntu
Posts: 421

Rep: Reputation: 31
What is segmentation fault?

This may sound like a stupid question but I really don't have a clue about this. Could anybody tell me what is "Segmentation Fault" actually refering to? I mean is it caused by bad memory management of the program or what?

Thanks for answering

Last edited by koyi; 08-28-2003 at 10:20 AM.
Old 08-28-2003, 07:08 AM   #2
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Yep - a program tries to write to a segment of RAM that's already in use, which would overwrite it. So, to prevent this, I believe it's the kernel or some part or appendage of it *g*, which basically shuts the offending program down. I don't know that it's bad memory *management*, so much as bad code in the particular app making it do stupid stuff. The fact that the fault is *caught* is actually good memory management, but I could be off there.

*awaits gurus for more complete explanation*
Old 08-28-2003, 07:35 AM   #3
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
linux on x86 runs in something called protected mode(other platforms have similar) this allows diferent regions of memory to have access permissions, a segmentation fault is caused when you do something with a memory segement that you dont have privilages for, eg trying to jump into a non executable segment, writing to a read only segment, or going out of bounds on a segment.

in programming there are many things you could do to cause a seg fault but the most common imo are dereferencing a NULL or wild pointer.
Old 08-30-2003, 01:03 AM   #4
Registered: Jul 2003
Location: Osaka, Japan
Distribution: Arch, Ubuntu
Posts: 421

Original Poster
Rep: Reputation: 31
Thanks guys! I think there is still a lot of things that I need to study about programming

HURRAH~~~!!! This is my 100th post!!!

Last edited by koyi; 08-30-2003 at 01:04 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what does Segmentation Fault mean ? baronlynx Linux - Newbie 10 10-25-2009 05:32 PM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika SUSE / openSUSE 2 12-02-2005 10:34 AM
Help !!! Segmentation fault mola Linux - Software 3 06-23-2005 12:13 PM
Segmentation fault tejas15_10 Programming 9 06-20-2005 10:12 AM
Segmentation fault santhosh_o Programming 3 10-26-2004 06:45 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration