From: Mark White (mjw@celos.net)
Date: Tue 15 Jan 2002 - 13:02:53 EST
Message-id: <20020115020253.E22531@celos.net>
Thomas Lumley writes:
> 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.
It was indeed 1.3.something. I agree that it sounds like a
memory leak in my code, but... I just tried compiling the
following C library routine (based on the arguments of a
file-reading function that's causing problems):
void R_test (char **filename, int *dim, Rcomplex *matrix)
{
double *ptr;
ptr = (double*) malloc(sizeof(double) * 25600);
free(ptr);
}
which, when called like this from within my R function
.C("R_test",as.character(filename),as.integer(adimi),
as.complex(im))
produces a segfault in Rf_duplicate soon after returning for
the somethingth time. If I make replace the last argument
with something like complex(5) - rather smaller than im - I
don't get an crash. Likewise I don't get a crash if I just
repeatedly call R_test from a simple command-line for(){}.
Is there something horribly wrong with my use of .C above?
> 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).
I've just tried this; it ran fine.
Mark <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This archive was generated by hypermail 2.1.3 : Thu 17 Jan 2002 - 11:10:11 EST