Re: [R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-14 Thread Henrik Bengtsson
As Jeff says, I think the common use case is to run/rerun in fresh R sessions. But, yes, if you'd like to have each script clean up after itself, then you need to check with pkgs0 <- loadedNamespaces() to see what packages are loaded when the script starts (not just attached) and then unload the o

Re: [R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-14 Thread Jeff Newmiller
I never detach packages. I rarely load more than 6 or 7 packages directly before restarting R. I frequently re-run my scripts in new R sessions to confirm reproducibility. -- Sent from my phone. Please excuse my brevity. On September 14, 2016 1:49:55 AM PDT, Alexander Shenkin wrote: >Hi Henr

Re: [R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-14 Thread Alexander Shenkin
Hi Henrik, Thanks for your reply. I didn't realize that floating DLLs were an issue (good to know). My query is actually a bit more basic. I'm actually wondering how folks manage their loading and unloading of packages when calling scripts within scripts. Quick example: Script1: l

Re: [R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-13 Thread Henrik Bengtsson
In R.utils (>= 2.4.0), which I hope to submitted to CRAN today or tomorrow, you can simply call: R.utils::gcDLLs() It will look at base::getLoadedDLLs() and its content and compare to loadedNamespaces() and unregister any "stray" DLLs that remain after corresponding packages have been unloaded

[R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-13 Thread Alexander Shenkin
Hello all, I have a number of analyses that call bunches of sub-scripts, and in the end, I get the "maximal number of DLLs reached" error. This has been asked before (e.g. http://stackoverflow.com/questions/36974206/r-maximal-number-of-dlls-reached), and the general answer is, "just clean up