Learn R Programming

R.oo (version 1.26.0)

.makeObjectFinalizer: Creates a standalone finalizer function for Object

Description

Creates a standalone finalizer function for Object, which assumes only that the base package is available.

Usage

.makeObjectFinalizer(this, reloadRoo=TRUE)

Value

Returns a function that can be passed to reg.finalizer().

Arguments

this

The Object to be finalized.

reloadRoo

If TRUE, the finalizer will try to temporary reload the R.oo package if not loaded.

Details

The created finalizer is reentrant. This is always the case when the R.oo package is already loaded when the finalizer is called. It is also always the case on R v2.15.2 Patched r61487 and beyond. In other cases, the finalizer inspects the call stack (via sys.calls()) to check whether parse() has been called or not. If it is on the call stack, it indicates that parse() triggered the garbage collection, and the R.oo package will not be reloaded in order to avoid risking parse() being called again.