Hola! There is a nuisance that the number of directories with name starting Rtmp (and always empty) in my temp directory is increasing over time. I put the following in my .Rprofile: tmp0001 <- tempdir() setHook( packageEvent("base","onUnload"), function(...) unlink( tmp0001, recursive=TRUE) ) which solves part of the problem, but not all. So there are also other tmpdirs made by R. Why, where, and why are they not removed at exit (when their content are removed)? Kjetil Halvorsen
On Tue, 27 Apr 2004 kjetil at acelerate.com wrote:> There is a nuisance that the number of directories with name starting > Rtmp (and always empty) in my temp directory is increasing over time. > > I put the following in my .Rprofile: > > tmp0001 <- tempdir() > setHook( packageEvent("base","onUnload"), > function(...) unlink( tmp0001, recursive=TRUE) ) > > > which solves part of the problem, but not all.I don't see why: package base is never unloaded so that hook function is never run. (Indeed, no package/namespace is unloaded except by explicit user action, in particular not when R is terminated.)> So there are also other tmpdirs made by R. Why, where, and why are they > not removed at exit (when their content are removed)?They are removed by R. This is a Windows-only bug, as Windows sometimes does not act on commands to remove empty directories (but only sometimes). Session temporary directories should only be left around when a session crashes. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On 28 Apr 2004 at 13:53, Prof Brian Ripley wrote:> On Tue, 27 Apr 2004 kjetil at acelerate.com wrote: >. .> I don't see why: package base is never unloaded so that hook function > is never run. (Indeed, no package/namespace is unloaded except by > explicit user action, in particular not when R is terminated.) > > > So there are also other tmpdirs made by R. Why, where, and why are > > they not removed at exit (when their content are removed)? > > They are removed by R. This is a Windows-only bug, as Windows > sometimes does not act on commands to remove empty directories (but > only sometimes).So is there anything I can do to remedy this nuisance (apart from reinstalling a newer XP (other messages indicates that can give surprises!) or changing OS)? Kjetil Halvorsen Session temporary directories should only be left> around when a session crashes. > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) 1 South > Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, > UK Fax: +44 1865 272595 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html