Re: [Rcpp-devel] Zero length vectors in R

2020-06-10 Thread Simon Urbanek
Toby, Rcpp simply calls allocVector() so regular R rules apply. R's SEXP can hold vectors up to length 1 inside without additional allocations*, therefore from memory management perspective writes to the first element of a 0-length vector are not invalid. The valgrind instrumentation of R doesn

Re: [Rcpp-devel] Zero length vectors in R

2020-06-10 Thread Dirk Eddelbuettel
On 10 June 2020 at 01:21, Leonardo Silvestri wrote: | The discussion you mention is most likely relevant here - other people | more versed than me in valgrind and R's memory allocation could probably | attest to that. | | Another idea to detect these errors would be to create a modified Rcpp |