Learn R Programming

R.utils (version 2.12.3)

onGarbageCollect: Registers a function to be called when the R garbage collector is (detected to be) running

Description

Registers a function to be called when the R garbage collector is (detected to be) running.

Usage

# S3 method for default
onGarbageCollect(fcn, action=c("prepend", "append", "replace"), ...)

Value

Returns (invisibly) the hooks successfully called.

Arguments

fcn

A function to be called without argument.

action

A character string specifying how the hook function is added to list of hooks.

...

Not used.

Author

Henrik Bengtsson

Examples

Run this code
if (FALSE) {
  onGarbageCollect(function(...) {
    message("The R garbage collector is running!")
  })
}

Run the code above in your browser using DataLab