search for: int_mat_int

Displaying 2 results from an estimated 2 matches for "int_mat_int".

2020 Sep 11
4
Garbage collection of seemingly PROTECTed pairlist
...st() at the end to make it into a regular list. I'm getting a strange garbage collection error. My PROTECTed pairlist prlst gets garbage collected away and causes a memory leak error when I try to access it. Here's my code. #include <Rinternals.h> SEXP C_int_mat_nth_row_nrnc(int *int_mat_int, int nr, int nc, int n) { SEXP out = PROTECT(Rf_allocVector(INTSXP, nc)); int *out_int = INTEGER(out); if (n <= 0 | n > nr) { for (int i = 0; i != nc; ++i) { out_int[i] = NA_INTEGER; } } else { for (int i = 0; i != nr; ++i) { out_int[i] = int_mat_int[n - 1 + i...
2020 Sep 12
0
Garbage collection of seemingly PROTECTed pairlist
...t; > I'm getting a strange garbage collection error. My PROTECTed pairlist prlst > gets garbage collected away and causes a memory leak error when I try to > access it. > > Here's my code. > > #include <Rinternals.h> > > > SEXP C_int_mat_nth_row_nrnc(int *int_mat_int, int nr, int nc, int n) { > SEXP out = PROTECT(Rf_allocVector(INTSXP, nc)); > int *out_int = INTEGER(out); > if (n <= 0 | n > nr) { > for (int i = 0; i != nc; ++i) { > out_int[i] = NA_INTEGER; > } > } else { > for (int i = 0; i != nr; ++i) { &...