[Rd] help with segmentation fault
Oleg Sklyar
osklyar at ebi.ac.uk
Sun May 4 23:19:20 CEST 2008
Katie,
99% it's a bug in your C code caused by accessing memory (probably
writing to) which was not allocated or freed already or out of boundary.
The fact that it worked fine on Windows is likely to be a pure
coincidence of different compiler/optimisation settings. However, the
main problem is that segfault is such a generic error that without
looking at the code one will not be able to tell you anything.
Debug it, get ddd with gdb and go step-wise or introduce lots of
pritouts to nail down the location of the problem.
Oleg
Kyeongmi Cheon wrote:
> Hello all,
> I'm trying to have C called by R. I wrote C codes that worked
> perfectly fine with R-2.6.0 in
>
> windows system ( using R tools).
>
> I had to change to SuSE Linux (this system has 3.2 GHz Intel
>
> Xeon processors and 4 GB of RAM), the C codes were compiled okay but
> when it was called to R-2.6.2, I got
>
> error mesage :
>
>
> ***caught segfault***
> address 0x1df5000, cause 'memory not mapped'
> segmentation fault
>
>
>
> According to C references, this kind of error occurs when you get
> something wrong with
>
> dereferencing pointers or go out of edge of arrays. But the very same
> codes were fine in windows
>
> and I did not find any related errors in my codes. How could this
> happen and how can I fix it? Does this have to do with different
> systems (linux vs windows) or C/R program?
>
> Thank you in advance.
--
Dr Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +44-1223-494466
More information about the R-devel
mailing list