search for: int_mat

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

Did you mean: int_max
2020 Sep 11
4
Garbage collection of seemingly PROTECTed pairlist
...n I call Rf_PairToVectorList() 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_i...
2020 Sep 12
0
Garbage collection of seemingly PROTECTed pairlist
...t; 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...