-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R6 $finalize() methods #20
Comments
...especially with #19. |
Should be private: https://r6.r-lib.org/articles/Introduction.html#finalizers. |
Actually, R is smart enough to free memory on garbage collection even when we go heavy on reference semantics. We will need a finalizer for the metadata database, but probably not in other situations. > mem_used()
101 MB
> x <- runif(1e8)
> mem_used()
901 MB
> a <- init_target()
> a$get_cache()$set_value("x", x)
> b <- init_target()
> b$get_cache()$set_value("x", x)
> rm(x)
> gc()
used (Mb) gc trigger (Mb) max used
Ncells 1369770 73.2 2067778 110.5 2067778
Vcells 103072729 786.4 151019151 1152.2 103222981
(Mb)
Ncells 110.5
Vcells 787.6
> mem_used()
901 MB
> rm(a)
> mem_used()
901 MB
> gc()
used (Mb) gc trigger (Mb) max used
Ncells 1369533 73.2 2067778 110.5 2067778
Vcells 103072906 786.4 151019151 1152.2 103222981
(Mb)
Ncells 110.5
Vcells 787.6
> mem_used()
901 MB
> rm(b)
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 1369203 73.2 2067778 110.5 2067778 110.5
Vcells 3072857 23.5 120815321 921.8 103222981 787.6
> mem_used()
101 MB
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For memory efficiency.
The text was updated successfully, but these errors were encountered: