segment error should be a running code has illegal memory access. (to a wrong segment?) so system can not run the program any further. then stop it and save some status in a core file. usually when i meet this error, i know that my pointer is invalid somewhere, so i add printf and use a debug tool to find it.