Closed Enchufa2 closed 2 years ago
Not a bug after all, it's just that we need to keep sure that we destroy the named environments properly (by overwriting or rm
'ing them) before returning from a function. E.g., this works just fine:
library(simmer)
simulate <- function() {
env <- simmer(mon=monitor_csv())
env <- env %>%
add_generator("dummy", trajectory(), function() c(1, -1)) %>%
run() %>%
wrap()
env
}
for (i in 1:2000)
env <- simulate()
This works fine:
But this quickly ends up in "too many open files".
so it seems that there's still some dangling environment around that prevents objects from being destroyed.