[Rd] Memory crash

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Oct 3 11:46:27 CEST 2008


Very likely your C code is writing out of bounds and has corrupted R's 
memory heap.  Use the tools discussed in 'Writing R Extensions' (such as 
Valgrind) to help you track this down.

On Fri, 3 Oct 2008, Göran Broström wrote:

> Hello,
>
> I get a segfault when running glmmboot in my own package glmmML. Has happened 
> many time before, but this time I get no hint of where in my C functions the 
> error might be. I give the output below. Can this be an R bug? I suspect it 
> has to do with repeated calls to 'vmmin' like this:

Based on past experience of users blaming their tools, the probability
that R is completely innocent here is close to one.

>           for (...){
>                vmax = vmaxget();
> 		vmmin(*p, b, &Fmin,
> 		      bfun, bfun_gr, *maxit, *trace,
> 		      mask, abstol, reltol, nREPORT,
> 		      ext, &fncount, &grcount, &fail);
> 		vmaxset(vmax);
>                ...
>           }
>
> but I am only guessing. Any suggestions?
>
> Ubuntu 8.04, R-2.7.2.
>
> Göran
> -------------------------------------------------------------------
> > glmmboot(y ~ x, cluster = cluster, data = res$dat, family = binomial, boot 
> = 400)
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000000041a817 in R_gc_internal (size_needed=3000) at memory.c:1317
> 1317	    PROCESS_NODES();
> (gdb) where
> #0  0x000000000041a817 in R_gc_internal (size_needed=3000) at memory.c:1317
> #1  0x000000000041c31c in Rf_allocVector (type=14, length=3000)
>    at memory.c:1968
> #2  0x000000000052a647 in duplicate1 (s=0x20cb4a0) at duplicate.c:214
> #3  0x00000000004e1775 in do_makelist (call=<value optimized out>,
>    op=<value optimized out>, args=0x1e18238, rho=<value optimized out>)
>    at builtin.c:645
> #4  0x000000000054697a in Rf_eval (e=0x10685a0, rho=0x1c557e0) at eval.c:492
> #5  0x000000000054a7ef in do_set (call=0x10684f8, op=0x936188, 
> args=0x1068530,
>    rho=0x1c557e0) at eval.c:1424
> #6  0x0000000000546896 in Rf_eval (e=0x10684f8, rho=0x1c557e0) at eval.c:463
> #7  0x00000000005474c0 in do_begin (call=0x1089ab0, op=0x936ef8,
>    args=0x10684c0, rho=0x1c557e0) at eval.c:1176
> #8  0x0000000000546896 in Rf_eval (e=0x1089ab0, rho=0x1c557e0) at eval.c:463
> #9  0x0000000000546896 in Rf_eval (e=0x1089960, rho=0x1c557e0) at eval.c:463
> #10 0x00000000005474c0 in do_begin (call=0x10fa1c0, op=0x936ef8,
>    args=0x10898f0, rho=0x1c557e0) at eval.c:1176
> #11 0x0000000000546896 in Rf_eval (e=0x10fa1c0, rho=0x1c557e0) at eval.c:463
> #12 0x0000000000548a4c in Rf_applyClosure (call=0x13714e8, op=0x10fa4e8,
>    arglist=0x1c551c0, rho=0x1e06538, suppliedenv=0x959c50) at eval.c:669
> #13 0x00000000005467b8 in Rf_eval (e=0x13714e8, rho=0x1e06538) at eval.c:507
> #14 0x000000000054a7ef in do_set (call=0x1371440, op=0x936188, 
> args=0x1371478,
>    rho=0x1e06538) at eval.c:1424
> #15 0x0000000000546896 in Rf_eval (e=0x1371440, rho=0x1e06538) at eval.c:463
> #16 0x00000000005474c0 in do_begin (call=0x137e938, op=0x936ef8,
>    args=0x1371408, rho=0x1e06538) at eval.c:1176
> #17 0x0000000000546896 in Rf_eval (e=0x137e938, rho=0x1e06538) at eval.c:463
> #18 0x0000000000548a4c in Rf_applyClosure (call=0x1e05ff8, op=0x137ef08,
>    arglist=0x1e060a0, rho=0x959c18, suppliedenv=0x959c50) at eval.c:669
> #19 0x00000000005467b8 in Rf_eval (e=0x1e05ff8, rho=0x959c18) at eval.c:507
> #20 0x0000000000416b95 in Rf_ReplIteration (rho=0x959c18, savestack=0,
>    browselevel=0, state=0x7fffca277fa0) at main.c:257
> #21 0x0000000000416e60 in R_ReplConsole (rho=0x959c18, savestack=0,
>    browselevel=0) at main.c:306
> #22 0x0000000000417140 in run_Rmainloop () at main.c:967
> #23 0x0000000000414c08 in main (ac=<value optimized out>,
>    av=<value optimized out>) at Rmain.c:35
> #24 0x00007f10c116a1c4 in __libc_start_main () from /lib/libc.so.6
> #25 0x0000000000414b29 in _start ()
>
> -- 
> Göran Broström               phone: 46 90 786 5223; 46 705 197 507
> Department of Statistics     fax: 46 90 786 6614
> Umeå University              email: gb at stat.umu.se
> SE-90187 Umeå, Sweden        http://www.stat.umu.se/personal/goran.brostrom
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-devel mailing list