Displaying 2 results from an estimated 2 matches for "largvec".
Did you mean:
argvec
2014 Dec 18
2
segfault when trying to allocate a large vector
Dear R contributors,
I'm running into trouble when trying to allocate some large (but in
theory viable) vector in the context of C code bound to R through
.Call(). Here is some sample code summarizing the problem:
SEXP test() {
int size = 10000000;
double largevec[size];
memset(largevec, 0, size*sizeof(double));
return(R_NilValue);
}
If size if small enough (up to 10^6), everything is
2014 Dec 18
0
segfault when trying to allocate a large vector
Hi Pierrick,
You're storing largevec on the stack, which is probably causing a stack
overflow. Allocate largvec on the heap with malloc or one of the R memory
allocation routines instead and it should work fine.
Karl
On Thu, Dec 18, 2014 at 12:00 AM, Pierrick Bruneau <pbruneau at gmail.com>
wrote:
>
> Dear R contributors,
>
> I'm running into trouble when trying to allocate some large...