search for: test_mem_alloc

Displaying 1 result from an estimated 1 matches for "test_mem_alloc".

2009 Dec 21
2
Limit on number of times Realloc can be called?
...an odd error that seems to suggest there is a limit on the number of times "Realloc" (the R version as defined in the manual "R-extenstions" not the C version "realloc") when I try to use the following program: #include <R.h> #include <Rinternals.h> SEXP test_mem_alloc(SEXP z) { double *t = Calloc(sizeof(double), double); *t = 2; SEXP end_product; int i = 0; for(i=1; i < 20; i++) { t = Realloc(t, sizeof(t) + sizeof(double), double); t[i] = i; } PROTECT(end_product = allocVector(REALSXP,6)); for(i = 0; i < 20; i++) { REAL(end_product)[i] = t[i]...