What can cause segmentation fault? im making a server and after ~100 connections it shows that segmentation fault and exits...
What can cause segmentation fault? im making a server and after ~100 connections it shows that segmentation fault and exits...
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.