Help with 'memory not mapped'
Dear Javier,
From your description, it seems you are not the author of the C
function rrfunc, which is where the problem is probably located (the segmentation fault is most likely a pointer related problem where the C code is trying to do something with memory it should not be trying to do). Depending on the exact settings of your simulation, the state of your machine, etc the problem will show up at one point or another. I'd get in touch with the author of the C code and let her/him know that there is a problem in it. Most of these are very quickly located using valgrind. Search on the archives and the manual (Writing R extensions) but a call such as R -d "valgrind --tool=memcheck --leak-check=full --log-file=marian.valgrind.log" --vanilla < mariam1_2.R > mariam1_2.with.valgrind.Rout after compiling the C code with the "-O1" (not -O2, as per default) flag. HTH, R.
On Fri, Mar 7, 2008 at 10:26 AM, <jgarcia at ija.csic.es> wrote:
Hi,
I'm no expert programmer at all;
I'm running an R script ("mariam1_2.R"). This scripts calls another
script, which contains an R function, which .Call some C code.
It runs several times without any problem, but sometimes I get the error:
-------
*** caught segfault ***
address 0x1c404ec8, cause 'memory not mapped'
Traceback:
1: .Call("rrfunc", as.double(dx), as.integer(nrows), as.integer(ncols),
as.double(deltadt), as.character(binmaps), as.integer(ldd),
as.double(downst),as.integer(outl), as.double(maxinte), as.double(nmn))
2: rrfuncR(dx, nrows, ncols, delta.t,binmaps.pathed,ldd,downst,
out.index,interc,n.man)
3: eval.with.vis(expr, envir, enclos)
4: eval.with.vis(ei, envir)
5: source("rrprogv1_2.R")
6: eval.with.vis(expr, envir, enclos)
7: eval.with.vis(ei, envir)
8: source("mariam1_2.R")
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
---------------
I've seen something related in the documentation, but it is not easy to
understand it for me. I'm trying to perform a Monte Carlo analysis that
calls the function iteratively. My question is why sometimes I can call
forty or fifty times the function without any problem, and other times it
crashes at the first, second or 6th time. Can you give me any advice?
Thanks and best regards,
Javier
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Ramon Diaz-Uriarte Statistical Computing Team Structural Biology and Biocomputing Programme Spanish National Cancer Centre (CNIO) http://ligarto.org/rdiaz