Startup/Initialization Memory Leak in R

Duncan Murdoch murdoch@stats.uwo.ca
Thu, 12 Sep 2002 11:31:03 -0400


On Thu, 12 Sep 2002 07:42:09 -0700 (PDT), you wrote in message
<Pine.A41.4.44.0209120738510.155470-100000@homer34.u.washington.edu>:

>
>Note that this about initialisation of the R shared library R.so, not the
>R executable.
>
>This may need fixing -- with a standalone executable the operating system
>will handle memory release when the program exits, but with an R library
>dynamically loaded into another process it won't.
>
>OTOH, why do you want to load and unload R lots of times?

I misunderstood the context.  The same problem would likely occur in
Windows if your application uses R.dll.

I agree that this should be fixed in the long term:  one might want to
instantiate multiple copies of R's evaluator in some application (e.g.
a new front-end that ran multiple consoles), and there should be a way
to shut them down and clean up afterwards.  In the meantime, the
workaround is probably to just keep a list of the activated copies,
and when a new one is needed, check if there's an unused one in the
list.  If so, execute some code to clean up the environment, and
re-use it.

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._