R Under development (unstable) (2024-07-02 r86866 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## This requires mirai (>= 0.13.2) > if (packageVersion("mirai") >= "0.13.2") { + library(future.mirai) + + mirai::daemons(1, dispatcher = FALSE) + plan(mirai_cluster) + + g <- function() 42 + h <- function() g() + + f <- future(h()) + v <- value(f) + print(v) + stopifnot(v == h()) + + plan(sequential) + mirai::daemons(0) ## Reset any daemons running + gc() + + } Loading required package: future [1] 42 used (Mb) gc trigger (Mb) max used (Mb) Ncells 457201 24.5 989634 52.9 633308 33.9 Vcells 825125 6.3 8388608 64.0 2033369 15.6 > > proc.time() user system elapsed 0.21 0.14 0.59