Skip to content

frollapply() issues #3993

@DavisVaughan

Description

@DavisVaughan

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.

double *dw[nk];

> frollapply(1, rep(1L, 1e6), identity)
Error: segfault from C stack overflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions