LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 08-28-2003, 06:01 AM   #1
koyi
Member
 
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 09:20 AM.
 
Old 08-28-2003, 06:08 AM   #2
slakmagik
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, 06:35 AM   #3
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
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, 12:03 AM   #4
koyi
Member
 
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 12:04 AM.
 
  


Reply


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 04:32 PM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika Suse/Novell 2 12-02-2005 09:34 AM
Help !!! Segmentation fault mola Linux - Software 3 06-23-2005 11:13 AM
Segmentation fault tejas15_10 Programming 9 06-20-2005 09:12 AM
Segmentation fault santhosh_o Programming 3 10-26-2004 05:45 AM


All times are GMT -5. The time now is 01:16 PM.

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