CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Segmentation fault??? (http://www.cfd-online.com/Forums/main/8849-segmentation-fault.html)

LiQiang March 13, 2005 21:13

Segmentation fault???
 
I am doing numerical simulation under Red Hat Linux9.0 , but I met error sometime, and " Segmentation fault" is printed to the screen and the program stopped, I do not know why this happens, Help needed.

Thanks in advance!

ag March 13, 2005 22:54

Re: Segmentation fault???
 
A segmentation fault generally points to a memory address error - usually caused by overrunning an array, in my experience. Try compiling with a -C option (for most compilers this enables array boundary checking) and see if it gives you any information when the program crashes.

vasanth March 14, 2005 13:21

Re: Segmentation fault???
 
Yes u r right? It happens to me when I forget to deallocate the arrays at the end of the program.(after allocating them at some point in the program). Hope it helps Bye


Sandip N. Jadhav March 18, 2005 14:25

Re: Segmentation fault???
 
Just compile ur code using -g option eg $gcc -lm -g test.c

and then do $gdb a.out $gdb run

Mostly program will crash, then type $gdb where

It will show u the location of problem in ur code.

Regards Sandip Jadhav

-- http://www.aero.iitb.ac.in/userpages/sandipj



All times are GMT -4. The time now is 23:15.