[R] segfault debugging

David Winsemius dwinsemius at comcast.net
Sat Dec 1 17:55:35 CET 2012


On Nov 30, 2012, at 10:02 AM, Donatella Quagli wrote:

> Hello everybody,
>
> I have written a script with two inline cfunctions. The script  
> crashes from time to time with:
>    *** caught segfault ***
>   address 0x10, cause 'memory not mapped'
>
> The crashs happen within R code after the cfunctions were executed.  
> Nevertheless I think
> that the pointers in my cfunctions are not used correctly.
>
> I tried to find some examples for debugging tools. I found something  
> like "R -d gdb". But I
> could not find an example how to use it with #!/usr/bin/Rscript. And  
> I cannot source the script
> within a running R session because I must run it with some args.
>
> Can anybody tell me as a non nerd step by step what I can do to  
> locate the problem? Can
> you recommend tools? If so how are they used with Rscript?

I think you may have difficulty defending your non-nerd claim if you  
are writing cfunctions in R. That said, you may want to look at a very  
recent SO answer by Hadley Wickham on StackOverflow:

http://stackoverflow.com/questions/13661065/r-superimpose-histogram-fits-in-one-plot

(I'm less nerdy than you, but it does appear that Hadley's code  
demonstrates efforts at checking for available memory and you may  
benefit from a worked example in Rcpp.)

-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list