Re: [Rd] memory allocation problem under linux

From: <antonio.dinarzo_at_studio.unibo.it>
Date: Mon 13 Jun 2005 - 10:12:14 GMT

Scrive Prof Brian Ripley <ripley at stats.ox.ac.uk>:

> You keep on sending similar messages -- this is at least the third. You
> need to find out where the segfault is occurring using gdb, and you have
> not told us.

Sorry for the repeated post (in 2 different mailing lists). Tnx for your suggestion. Now I think I've found the problem. Try this: ////file foo.c
#include <R.h>
int **box;
void foo(){
  int i;
  box = (int**)R_alloc(1, sizeof(int *)); }
/////////////
Compiled with R CMD SHLIB foo.c
In R:
>dyn.load("foo.so")
>.C("foo")

*Segmentation fault*
The problem disappears when the declaration of 'box' comes inside the function foo... Is this a bug?

Antonio, Fabio Di Narzo.



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Jun 13 20:34:07 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:09 GMT