Skip to content
Prev 54371 / 63421 Next

Truncating vectors by reference in C-backend

DO NOT DO THIS!!! SETLENGTH and SET_TRUELENGTH are NOT part of the API
and are for internal use only.

Tho proper way to do this is to copy the data you want into a smaller
vector and allow the larger one to be garbage collected.

[VECSXPs are like all other vectors in that they are contigously
allocated by malloc, and there is no mprtable way to return part
a memory region allocated by malloc back to malloc].

There is experimental INTERNAL support for growable vectors that is
managed with INTERNALLY with TRUELENGTH and a bit setting, but this is
NOT, at leat not yet, intended for use by packages. The ALTREP
framework that should be available in the next release might allow
something like this to be done, but care is needed to make sure R's
copying semantics are adhered to.

Best,

luke
On Tue, 21 Nov 2017, mbonsch at posteo.de wrote: