[Rd] R_alloc problems in R v1.11

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Jul 6 23:22:17 CEST 2005


Marie-Hélène Ouellette <marie-helene.ouellette at umontreal.ca> writes:

> Dear Dr. Ripley,

Believe it or not, there are several people on this list who are not
Dr.Ripley. In fact, I suspect that he is temporarily absent these
days. Had he been present he would likely have explained that none of
us need to read the same message five times over...

> I'm using the R v1.11 on Macintoch and I seem to have a problem with the

Say what? There was never an R version with that number. Is this Mac OS X
or classic Mac?

> function R_alloc. It crashes when using the following .C function (only an
> example):

*How* does it "crash"? R shuts down? Prints an infinite stream of "salut!!!"?
What did you do to compile and did you see any warnings from the compilation?
 
> ///////////////////////////////
> # include <R.h>
> void Hello(int *n)
> {
> int i,x;
> for(i=1;1< *n ; i++)
> {
> 	Rprintf('salut!!!\n');
> }
> x = (int *) R_alloc(5,sizeof(int));
> }
> 
> ///////////////////////////////
> 
> I call it in R with this line:
> 
> .C('Hello',as.integer(5))

and then what happens?

> Any idea why and how I can resolve this problem?


Well, if that is really your code, x is an int that gets an int *
assigned to it, but 1 is never going to be bigger than *n, so I don't
see how you'd get that far.


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list