[R] Segmentation fault using integrate()
thomas at biostat.washington.edu
Thu Jan 20 00:07:35 CET 2000
On Wed, 19 Jan 2000, Ben Bolker wrote:
> I'm not sure what's going on, but I have had a similar problem, and a
> workaround. The following code will fairly reliably crash R:
> I think the problem may have to do with cleanup on return from an error:
> if I exclude 0 from xvec above, so that I don't get the following warning
> Warning message:
> Ifail=2, lenwrk was too small. -- fix adapt() !
> Check the returned relerr! in: adapt(ndim = 2, lower = c(0, 0), upper
> then I don't get the crashes.
> The workaround is to call gc() every time after you call integrate() ...
> you can see if it works for you.
The problem is not to do with error recovery. Like most segfaults it is a
pointer protection bug, which is why using gc() at different times often
hides the bug.
The argument to eval() in adapt_callback.c was a temporary object created
but not protected. If garbage collection happened in exactly the wrong
place it gets clobbered. After fixing it I've run the example fifty times
without an error. I've sent a replacement to CRAN.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help