[R] dyn.load the same code more than once?

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jan 5 19:09:38 CET 2001


On Fri, 5 Jan 2001, Matthew Wiener wrote:

> 
> Hi.  I'm still working on figuring out why some C code that interfaced
> nicely with R-1.1.1 is causing segmentation faults in R-1.2.0.  Brian
> Ripley advised me that R-1.2.0 can be more sensitive to array overruns
> than was R-1.1.1, so I'm looking for overruns.  But in the course of
> running R with a debugger I've come across something else.
> 
> Without thinking about it much, I put the dyn.load statement loading my
> compiled code into the function immediately before the code is called.
> This means that the dyn.load call is being executed over and over.  This
> has never seemed to cause a problem, but under the debugger I get an error
> after several times that some address cannot be accessed (the exact
> address changes from time to time).  If I'm not in the debugger, this
> doesn't happen, but perhaps it has something to do with my eventual memory
> corruption.
> 
> So my question is:  can multiple loading of code cause a problem?  If so,
> what kind? 

Well, there are finite resources in src/unix/dynload.c, like for 100
loads.

> Also, I'll try loading the code in my .First function instead.  Can this
> lead to any problems (like memory issues if I load lots of functions)?

Not at all.  You only load the code, don't find all the entry points.
It is what we advise.

> 
> I'm working on an alpha running Red Hat Linux.
> 
> Thanks,
> 
> Matt Wiener
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help 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-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list