Skip to content

reg.finalizer(..., add=FALSE)?

2 messages · Henrik Bengtsson, Duncan Murdoch

#
Is it possible to (i) clear or (ii) override already registered
finalizer functions, e.g. reg.finalizer(e, f, add=FALSE) cf.
on.exit(..., add=FALSE)?

Currently:
NULL
NULL
NULL
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 115827  3.1     350000  9.4   350000  9.4
Vcells  77109  0.6     786432  6.0   370917  2.9
Finalizer C!
Finalizer B!
Finalizer A!
         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 115932  3.1     350000  9.4   350000  9.4
Vcells  77648  0.6     786432  6.0   370917  2.9

I wish to have only finalizer "C" to run.

/Henrik
#
On 07/07/2009 8:36 PM, Henrik Bengtsson wrote:
No, but you can have the finalizer function call something else, and 
change the thing it calls.  E.g.

reg.finalizer(env, function (...) CleanUp(...))

will call CleanUp in the global environment (the environment of the 
anonymous finalizer); change that function and the cleanup behaviour 
will change.

Duncan Murdoch