Re: [Rd] segfault when trying to allocate a large vector

2014-12-18 Thread Pierrick Bruneau
Hi Karl, I thought I had also tried to allocate on the heap - just tried again, and everything went fine (even up to 10^9 cells). I guess everything's OK then ^^ Thanks for your help! Pierrick On Thu, Dec 18, 2014 at 9:44 AM, Karl Millar wrote: > Hi Pierrick, > > You're storing largevec on the

Re: [Rd] segfault when trying to allocate a large vector

2014-12-18 Thread Karl Millar via R-devel
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 wrote: > > Dear R contribu

[Rd] segfault when trying to allocate a large vector

2014-12-18 Thread Pierrick Bruneau
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 = 1000; double largevec[size]; memset(largevec, 0, size