R version 4.4.0 beta (2024-04-15 r86425 ucrt) -- "Puppy Cup" 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 450941 24.1 971711 51.9 633382 33.9 Vcells 813798 6.3 8388608 64.0 2003769 15.3 > > proc.time() user system elapsed 0.31 0.09 0.59