-
Notifications
You must be signed in to change notification settings - Fork 2
Description
in binsegRcpp there is an argument IntegerVector max_segments which could have zero length and cause problems. how can we detect that using RcppDeepState and tell the user to change that?
here is the related rcpp-devel thread http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2020-June/010465.html
from R internals
1.13.1 Internals of RallocThe memory used byR_allocis allocated as R vectors, of typeRAWSXP. Thus the allocationis in units of 8 bytes, and is rounded up. A request for zero bytes currently returnsNULL(butthis should not be relied on). For historical reasons, in all other cases 1 byte is added beforerounding up so the allocation is always 1–8 bytes more than was asked for: again this shouldnot be relied on.The vectors allocated are protected via the setting ofR_VStack, as the garbage collectormarks everything that can be reached from that location. When a vector isR_allocated, itsATTRIBpointer is set to the currentR_VStack, andR_VStackis set to the latest allocation.ThusR_VStackis a single-linked chain of the vectors currently allocated viaR_alloc. Functionvmaxsetresets the locationR_VStack, and should be to a value that has previously be obtainedviavmaxget: allocations after the value was obtained will no longer be protected and henceavailable for garbage collection.