You may be over-complicating this. Taking mcmc_new in src/lm_lcmc.c
from https://github.com/merliseclyde/BAS, to minimize code changes I
would arrange the memory management along these lines:
SEXP mcmc_new(...)
{
/* ... */
/* create and protect ANS */
SEXP ANS = PROTECT(allocVector(V
Thanks Luke ! I had seen the usage and discussion of growable vectors, as
well as using SET_TRUELENGTH with SETLENGTH and didn't necessarily want to get
even more out of API compliance :-). but if that looks like it will allowed
(subject to perhaps changes) that seems like the better way forw
On Wed, 15 Jan 2025, Iris Simmons wrote:
I don't think memcpy works well for VECSXP. The elements being overwritten
need to have their reference counts decreased and the new elements need to
have theirs increased.
You do not want to use memcpy or inanyother way try to write to the
locations in