[Rd] debugging strange segfault

Liaw, Andy andy_liaw at merck.com
Fri Jan 9 03:51:50 MET 2004


Dear R-devel,

Can anyone give me some hints on how to go about debugging a strange
segfault in my randomForest package?  Here's the scoop:

A user reported segfault when running predict() in the randomForest package.
I asked for the data and code.  The combination runs fine under WinXPPro,
but does give segfault on one of our Linux boxes running R (1.7.0 through
R-devel_2004-01-08) on Mandrake 9.0. 

The predict.randomForest() function calls a C function "runforest" via
.C(..., DUP=FALSE, ...), which in turns calls a Fortran subroutine
"testreebag" within a for loop.  The segfault seems to occur right after
finishing the runforest() function in C and returning to R.  I inserted the
line:

Rprintf("Done!\n");

as the last line of the runforest() function and got the following output:

> library(randomForest, lib.loc="~/rlibs")
> arabid <- read.table('arabidopsis.out', sep=' ', header=T)
> arabid <- arabid[,-which(names(arabid) == "X0")]
> set.seed(1)
> fit <- randomForest(arabid[,-1], arabid[,1], ntree=100)
> predict(fit, arabid[,-1])
Done!

Program received signal SIGSEGV, Segmentation fault.
0x40152a48 in malloc () from /lib/libc.so.6

[If I change the DUP=FALSE in the .C() call to TRUE, I get the following:
Program received signal SIGSEGV, Segmentation fault.
0x080b412b in Rf_duplicate (s=0x1) at duplicate.c:75
75          switch (TYPEOF(s)) {
]

At this point I'm clueless as to what to do next, and would very much
appreciate any help!

Best,
Andy

Andy Liaw, PhD
Biometrics Research      PO Box 2000, RY33-300     
Merck Research Labs           Rahway, NJ 07065
mailto:andy_liaw at merck.com        732-594-0820




------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}



More information about the R-devel mailing list