Call finalizer
finalize.rdThis calls the currently assigned finalizer, either via R's finalization mechanism or manually.
Usage
finalize(x, ...)
# S3 method for class 'ff_pointer'
finalize(x, ...)
# S3 method for class 'ff'
finalize(x, ...)
# S3 method for class 'ffdf'
finalize(x, ...)Details
The finalize.ff_pointer method is called from R after it had been passed to reg.finalizer. It will set the finalizer name to NULL and call the finalizer.
The finalize generic can be called manually on ff or ffdf objects. It will call the finalizer but not touch the finalizer name.
For more details see finalizer
Note
finalize.ff_pointer MUST NEVER be called manually - neither directly nor by calling the generic on an ff_pointer (could erroneously signal that there is no pending finalization lurking around)
Value
returns whatever the called finalizer returns, for ffdf a list with the finalization returns of each physical component is returned.
Examples
x <- ff(1:12, pattern="./finalizerdemo")
fnam <- filename(x)
finalizer(x)
#> [1] "close"
is.open(x)
#> [1] TRUE
file.exists(fnam)
#> [1] TRUE
finalize(x)
#> [1] TRUE
finalizer(x)
#> [1] "close"
is.open(x)
#> [1] FALSE
file.exists(fnam)
#> [1] TRUE
delete(x)
#> [1] TRUE
finalizer(x)
#> [1] "close"
is.open(x)
#> [1] FALSE
file.exists(fnam)
#> [1] FALSE
rm(x)
gc()
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 1248844 66.7 2239654 119.7 2239654 119.7
#> Vcells 2298007 17.6 8388608 64.0 8387257 64.0