[Rd] R_alloc problem on Mac OSX (PR#8683)

dan.kelley@dal.ca dan.kelley at dal.ca
Wed Mar 15 17:33:01 CET 2006


Full_Name: Dan Kelley
Version: 2.2.1
OS: Mac OSX
Submission from: (NULL) (129.173.23.36)


I'm having difficulties getting R_alloc() to work on a 64-bit Mac running R
2.2.1 installed via a .dmg file obtained from the R site.  Details are given
below, in a level of detail that I hope is appropriate.  My eye was particularly
drawn to line #2 in the gdb 'where' output, but line #1 seems sensible so I may
just be displaying my ignorance by drawing attention to this.

I wonder, is there something I should be doing first, to initialize memory?

 ......

$ R --version
R 2.2.1 (2005-12-20).
Copyright (C) 2005 R Development Core Team

$ gcc -g -o test5 test5.c
-I/library/Frameworks/R.framework/Versions/2.2/Resources/include/
-L/library/Frameworks/R.framework/Versions/2.2/Resources/lib/ -lR -lm
/usr/bin/ld: warning multiple definitions of symbol _signgam
/library/Frameworks/R.framework/Versions/2.2/Resources/lib//libR.dylib(lgamma.lo)
definition of _signgam
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libm.dylib(gamma9.o)
definition of _signgam

$ gdb test5
GNU gdb 6.1-20040303 (Apple version gdb-413) (Wed May 18 10:17:02 GMT 2005)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...Reading symbols for shared
libraries .... done

(gdb) run
Starting program: /Users/kelley/src/R-from-fortran/test5
Reading symbols for shared libraries .........+ done
about to call R_alloc(1,4)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000000c
GetNewPage (node_class=1) at ../../../../R-2.2.1/src/main/memory.c:622
622     ../../../../R-2.2.1/src/main/memory.c: No such file or directory.
        in ../../../../R-2.2.1/src/main/memory.c
(gdb) where
#0  GetNewPage (node_class=1) at ../../../../R-2.2.1/src/main/memory.c:622
#1  0x00293d38 in Rf_allocVector (type=9, length=4) at
../../../../R-2.2.1/src/main/memory.c:1918
#2  0x002932e8 in R_alloc (nelem=25167368, eltsize=1996) at
../../../../R-2.2.1/src/main/memory.c:1604
#3  0x00002ad0 in main () at test5.c:8
(gdb) list
617     in ../../../../R-2.2.1/src/main/memory.c
(gdb) file test5
Load new symbol table from "/Users/kelley/src/R-from-fortran/test5"? (y or n) y
Reading symbols from /Users/kelley/src/R-from-fortran/test5...done.
(gdb) list
1       #include <stdio.h>
2       #include <R.h>
3       int main()
4       {
5               int *t;
6               long int n = 1;
7               printf("about to call R_alloc(%d,%d)\n",n,sizeof(int));
8               t = (int *) R_alloc(n, sizeof(int));
9               printf("done\n");
10              return(0);
(gdb) src/R-from-fortran/



More information about the R-devel mailing list