Displaying 2 results from an estimated 2 matches for "vec_1".
Did you mean:
vec1
2023 Apr 29
1
Forcing a PROTECT Bug to Occur
...o access deallocated memory, or maybe
print out nonsense results because the unprotected memory got overwritten,
but I can't make either happen.
Here's my current code (all in R, using the inline package for simplicity):
> gctorture(TRUE)
> z = inline::cfunction(body="
SEXP vec_1 = Rf_ScalarInteger(99);
SEXP vec_2 = Rf_allocVector(VECSXP, 10);
SET_VECTOR_ELT(vec_2, 1, vec_1);
Rf_PrintValue(vec_2);
")
My thinking was that, with torture mode enabled, the allocation of vec_2
should ensure that vec_1 is collected, and then trying to put it into vec_2
and then...
2023 Apr 30
0
Forcing a PROTECT Bug to Occur
On 4/30/23 06:05, Michael Milton wrote:
> Hi Tomas, thanks for the reply.
>
> I played with some of the factors you mentioned like allocating more
> INTSXP of the same size as vec_1, to little success. The thing that
> actually "worked" and caused a segfault, was simply allocating a
> larger vector the first time. 100 elements seemed to do it, but 10 or
> less elements almost never caused a segfault. Is there some other part
> of memory that small vec...