Displaying 1 result from an estimated 1 matches for "rtmp9cwltn".
2011 Jul 22
1
reg.finalizer and connection gc -- which runs when (and why)?
...)
ev$f <- file(tf, "w")
reg.finalizer(ev, finalizer)
rm(ev)
gc()
whereas this (reversing the order of file() and reg.finalizer())
ev <- new.env()
reg.finalizer(ev, finalizer)
ev$f <- file(tf, "w")
rm(ev)
produces
> gc()
Warning: closing unused connection 3 (/tmp/Rtmp9CWLtN/file6998ee7b)
finalizer
Error in close.connection(obj$f) : invalid connection
In some respects, it seems like the user should get a chance to clean up
their mess before the system does it for them, so the above seems like a
bug. But maybe there is another way to understand this?
Martin
--
Comp...