[R] .Call function crashes initializing matrix

Erik Wright eswright at wisc.edu
Sun Apr 11 00:23:08 CEST 2010


Hello,

I have a C function that I call from R using .Call.  I recently discovered a bug in my code, and I am not sure if it is a problem with what I am doing in C or if it has something to do with my use of .Call.

I have narrowed my problem down to these two C statements:
int size = 5000;
double matrix[size][size];

When I run this in R it crashes, with this message:
 *** caught segfault ***
address 0xb4141d70, cause 'memory not mapped'

It has no problem when size is smaller, like 50.  Any idea what is going on?

Thanks!,
Erik


sessionInfo()
R version 2.10.1 (2009-12-14) 
i386-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base



More information about the R-help mailing list