From hb at stat.berkeley.edu  Wed Jul  8 02:36:48 2009
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Tue, 7 Jul 2009 17:36:48 -0700
Subject: [Rd] reg.finalizer(..., add=FALSE)?
Message-ID: <59d7961d0907071736j73f22031y291662df97968293@mail.gmail.com>

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:

> env <- new.env()
> reg.finalizer(env, function(...) cat("Finalizer A!\n"))
NULL
> reg.finalizer(env, function(...) cat("Finalizer B!\n"))
NULL
> reg.finalizer(env, function(...) cat("Finalizer C!\n"))
NULL
> gc()
         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
> rm(env)
> gc()
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



[Rd] reg.finalizer(..., add=FALSE)?
Henrik Bengtsson