You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like that the function environment where the generator is created and used is never released, even if the generator itself is not in scope anymore.
Here's a reprex:
g<-function() {
hello<- sample(1:1e7) # large object to easily verify the leakgenerate_abc<-coro::generator(function() {
for (xinletters[1:3]) {
coro::yield(x)
}
})
coro::loop(for(xin generate_abc()) {
y<-x
})
}
for (xin1:10) {
g()
gc()
print(lobstr::mem_used())
}
#> 84,001,952 B#> 124,300,760 B#> 164,343,576 B#> 204,386,400 B#> 244,429,208 B#> 284,472,048 B#> 324,514,856 B#> 364,557,664 B#> 404,600,472 B#> 444,643,344 B