[R] Segmentation fault

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Nov 4 15:19:22 CET 2001

Göran Broström <gb at stat.umu.se> writes:

> Dear R-afficionados,
> I have made a package that uses compiled C code, and I use the
> Calloc/Free mechanism in that code. When I run a function calling 
> the C code, everything is fine, but when I run it once more I get
> ('R -d gdb', RH 7.2, R-1.3.1):
> > te()
> Program received signal SIGSEGV, Segmentation fault.
> RunGenCollect (size_needed=41992) at memory.c:1007
> 1007			SEXP next = NEXT_NODE(s);
> My guess is that I haven't Free'd enough in the C code. Before I start
> searching, I would like to have an expert opinion. Could the reason be 
> something else?

That should just give you a memory leak where some memory is not
returned to the system.

More likely, you Free'd something that wasn't Calloc'd...

You might want to try a gc() immediately after the first call to te()
or turning on gctorture().

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
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