Creates an ALTREP vector using a file-backed fmalloc runtime. The returned
object is ALTREP from creation time. Fixed-width atomic payload bytes are
allocated directly with fmalloc, and ALTREP duplication and vector subsetting
keep copy-on-write copies fmalloc-backed without using R's non-API
Rf_allocVector3() path.
Arguments
- type
Character string specifying the vector type. Supported values are
"logical","integer","numeric"/"double","raw","complex","character", and"list". Fixed-width atomic types expose a direct writable fmallocDATAPTR; character vectors store string bytes in fmalloc and materialize RCHARSXPvalues on demand; list vectors use ALTREP element access with an R-visible reference sidecar for GC safety and only acceptNULLor fmalloc-backed vectors from the same runtime as elements. Persistent list containers are serialized by nested reference states when all elements are recoverable from the same runtime.- length
Integer specifying the non-negative length of the vector to create.
- runtime
Optional runtime handle returned by
open_fmalloc(). If not supplied, the default runtime established byinit_fmalloc()is used.- zero_initialize
Logical scalar. If TRUE (default), newly allocated payload bytes are zero-initialized. Set FALSE to skip initialization for faster large allocations when you will fully initialize values yourself.
Examples
if (FALSE) { # \dontrun{
rt <- open_fmalloc(tempfile(fileext = ".bin"))
v <- create_fmalloc_vector("integer", 1000, runtime = rt)
cleanup_fmalloc(rt)
} # }