addFinalizer: Register a cleanup finalizer for a C/C++ object

addFinalizerR Documentation

Register a cleanup finalizer for a C/C++ object

Description

This function registers a native finalizer with the specified external pointer. This routine is then invoked when the object is garbage collected. This allows us to free resources and memory associated with this object.

Usage

addFinalizer(obj, finalizer, default = character(), ...)

Arguments

obj

the object to which the finalizer is to be associated.

finalizer

the routine that is to be called when the obj is garbage collected. This can be an R function, a character string giving the name of the routine to invoke, a NativeSymbolInfo object identifying the routine, or the address of the routine. See getNativeSymbolInfo

default

the finalizer object

...

additional arguments passed to methods

Value

A logical value indicating whether the finalizer was registered.

Author(s)

Duncan Temple Lang

References

Writing R Extensions Manual.


omegahat/RAutoGenRunTime documentation built on Jan. 12, 2023, 9:19 p.m.