Thread: Segmentation fault

  1. #1
    Registered User
    Join Date
    Dec 2006

    Lightbulb Segmentation fault

    What can cause segmentation fault? im making a server and after ~100 connections it shows that segmentation fault and exits...

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    All sorts of things
    - running off either end of allocated memory (trying to access the n'th index of an array with n elements)
    - using memory before you allocate it (usually an uninitialised or NULL pointer)
    - using memory after you've freed it (it might now belong to someone else)
    - freeing the same thing twice
    - freeing something which was never allocated

    If you're on Linux, you might try valgrind or electic fence to help you find the problem.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

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