ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.