Thread: Segmentation Fault

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    1

    Segmentation Fault

    Hi!

    What are the reasons for a segmentation fault?

    My program doesn't always cause a segmentation fault, only sometimes although the program flow is exactly the same. Do you have any ideas?

    I'm using RedHat Linux and KDevelop.


    Thanks and best regards
    Haos

  2. #2
    Watch for flying houses. Nessarose's Avatar
    Join Date
    Sep 2004
    Posts
    46
    When you try to access memory that you're not supposed to, you get a segmentation violation. Typically this can happen when you're working with arrays and pointers.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >My program doesn't always cause a segmentation fault, only sometimes although the
    >program flow is exactly the same. Do you have any ideas?
    Some times you get lucky and some times you don't.

    >What are the reasons for a segmentation fault?
    Accessing memory outside of your address space is the #1 reason. Make sure you aren't writing somewhere that you shouldn't be first thing.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation fault problem
    By odedbobi in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2008, 03:36 AM
  2. Segmentation fault
    By bennyandthejets in forum C++ Programming
    Replies: 7
    Last Post: 09-07-2005, 05:04 PM
  3. Segmentation fault
    By NoUse in forum C Programming
    Replies: 4
    Last Post: 03-26-2005, 03:29 PM
  4. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 01:33 PM
  5. Segmentation fault...
    By alvifarooq in forum C++ Programming
    Replies: 14
    Last Post: 09-26-2004, 12:53 PM