[Rd] Memory corruption in dynamically loaded code

From: Emmanuel Sharef <ess28_at_cornell.edu>
Date: Fri 12 Jan 2007 - 22:17:10 GMT


Hello,

I've compiled some Fortran code and dyn.loaded it into R as in the "Writing R Extensions" manual. The code receives four large arrays of doubles from R (size about 3000x3000), and runs through several loops with BLAS calls. However, I get a memory corruption error when running it -- the full output is attached at the end.

I've been trying to pinpoint and solve the problem, and two things seem odd to me: First, if I run the same code with a much smaller data set, so that the arrays are about 500x500 each, there are no problems (this seems to indicate that I'm not writing outside array bounds). Second, using the gdb debugger (with ddd frontend), I noticed that the error only occurs on the second pass through the main Fortran code loop, which should not be very different from the first. The crash occurs during a call to the BLAS routine DSYR.

I've been trying to replicate the problem in a smaller code snippet for posting to the list, but haven't had any luck so far. Perhaps there are some ideas based on the output?

This is with R 2.4.1 on Ubuntu, and also occurs with R 2.4.1 on Mac OS X (gcc 3.4.6 and 3.4.2 respectively).

Many thanks,
Emmanuel


R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Jan 13 09:19:17 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 12 Jan 2007 - 22:31:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.