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 :) |
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* |
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. |
Thanks guys! I think there is still a lot of things that I need to study about programming :study:
HURRAH~~~!!! This is my 100th post!!! :D |
All times are GMT -5. The time now is 02:45 AM. |