Registers a function to be called when the R garbage collector is (detected to be) running.
# S3 method for default onGarbageCollect(fcn, action=c("prepend", "append", "replace"), ...)
A function to be called without argument.
function
A character string specifying how the hook function is added to list of hooks.
character
Not used.
Returns (invisibly) the hooks successfully called.
# NOT RUN { onGarbageCollect(function(...) { message("The R garbage collector is running!") }) # }
Run the code above in your browser using DataCamp Workspace