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.
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.