[R] Problems with .C - [Ff]ree()?

Thomas Lumley tlumley at u.washington.edu
Tue Jan 15 00:22:53 CET 2002


On Mon, 14 Jan 2002, Mark White wrote:

> I've just pulled my R installations up to 1.4.0, and am
> having trouble with some of my dyn.load'd C code: R
> frequently segfaults after .C calls into the (newly rebuilt)
> libraries.  It hasn't happened with any previous versions of
> R I've used.
>
> I do seem to be able to make things behave by removing calls
> to free().  Changing everything to Calloc() and Free(),
> didn't help, however.  Stack traces aren't especially
> useful; it often segfaults in operations relating to freeing
> vectors, but not always: for example, I recently has a spate
> of segfaults in seq().  It does appear to behave if I remove
> all the .C calls.  It also seems to be more stable if I've
> already created some large vectors in R before I start
> making external calls.
>

Very Strange.  It does sound suspiciously as though you are using pointers
after they have been free()d, but I don't see how the upgrade would have
triggered this -- I assume you upgraded from 1.3.x, not from something
ancient.

Do you get segfaults running R CMD check on the survival package? This
uses Calloc/Free quite a bit (probably so do other base/recommended
packages).

If not, does your code cause a segfault if it is in a package or only when
dyn.load()ed directly?


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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