Hi all, I was reading the source for frollapply(), and saw two things that I thought might be problematic.
The first is a protection stack overflow. I think that looping here and constructing a SEXP for both the window and the call for each k is causing this issue. You could probably restructure this loop to be inside the double loop below it (which you might also have to reverse the order of) to only construct them one at a time, and unprotect them after each usage.
|
pw[j] = PROTECT(allocVector(REALSXP, ik[j])); protecti++; |
> frollapply(1, rep(1L, 1e5), identity)
Error: protect(): protection stack overflow
The other is a C stack overflow. I imagine this is related, and comes from constructing this double pointer array on the stack (and maybe the SEXP arrays as well, but im not sure). nk = 1e6 is pretty big.
> frollapply(1, rep(1L, 1e6), identity)
Error: segfault from C stack overflow
Hi all, I was reading the source for
frollapply(), and saw two things that I thought might be problematic.The first is a protection stack overflow. I think that looping here and constructing a SEXP for both the window and the call for each
kis causing this issue. You could probably restructure this loop to be inside the double loop below it (which you might also have to reverse the order of) to only construct them one at a time, and unprotect them after each usage.data.table/src/frollR.c
Line 316 in b8dd0db
The other is a C stack overflow. I imagine this is related, and comes from constructing this double pointer array on the stack (and maybe the SEXP arrays as well, but im not sure).
nk = 1e6is pretty big.data.table/src/frollR.c
Line 310 in b8dd0db