From murdoch at stats.uwo.ca  Mon Jun 26 22:25:15 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 26 Jun 2006 16:25:15 -0400
Subject: [Rd] a new way to crash R? (PR#8981)
In-Reply-To: <20060626113150.62CFD5081D@slim.kubism.ku.dk>
References: <20060626113150.62CFD5081D@slim.kubism.ku.dk>
Message-ID: <44A042AB.7000503@stats.uwo.ca>

On 6/26/2006 7:31 AM, ripley at stats.ox.ac.uk wrote:
> This works for me on both Linux and Windows.
> 
> Please check your memory usage: it does need about 900Kb of VM, and as you 
> have less RAM than that installed you need to set --max-mem-size=1G or 
> some such.
> 
> (It is quite likely that this is a Windows memory allocation failure: that 
> has been reported before but not tracked down.)

I can make it reproducible now.  It happens relatively quickly when I 
set max-mem-size=100M.  In R-devel, there's a call to malloc at line 
1952 of memory.c, and as R is running out of memory, that returns a -1 
instead of a zero.  This causes a seg fault a few lines later.

The malloc code is quite complicated, so I can't see exactly why we're 
getting the -1.

Duncan Murdoch

> 
> On Wed, 14 Jun 2006, jritter at umn.edu wrote:
> 
>> This is a multi-part message in MIME format.
>> --------------010500030900050501010804
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>> Content-Transfer-Encoding: 7bit
>>
>> Dear R Team,
>>
>> First, thank you for incredibly useful software!
>>
>> Now the bad news:  The attached script (or the original version with
>> real data) will reliably crash R on my machine.  I am using:
>>
>> R version: either 2.2.1 or 2.3.1
>> Windows 2000 Professional, Service Pack 4
>> 512 MB of RAM
>>
>> On my machine the script will crash R on line 42 [  probits21 <-
>> lapply(...  ].
>>
>> In both this script and the "real" one, memory.size() indicates that R
>> is about 512 MB just before executing the command that crashes it.  In
>> other contexts, R has been able to allocate virtual memory on this
>> computer without any trouble.
>>
>> Thanks again for all your work on R.
>>
>> Regards,
>>
>> Joe Ritter
>>
>> --------------------------------------------------------------------------
>> Joseph A. Ritter
>> Associate Professor
>> Humphrey Institute of Public Affairs
>> University of Minnesota
>> Minneapolis, MN  55455
>> U.S.A.
>> 612-625-0442
>>
>> --------------010500030900050501010804
>> Content-Type: text/plain;
>> name="crash.r"
>> Content-Transfer-Encoding: 7bit
>> Content-Disposition: inline;
>> filename="crash.r"
>>
>> x1 <- rnorm(10000)
>> x2 <- rnorm(10000)
>> x3 <- rnorm(10000)
>> x4 <- rnorm(10000)
>> x5 <- rnorm(10000)
>> x6 <- rnorm(10000)
>> x7 <- rnorm(10000)
>> x8 <- rnorm(10000)
>> y <- round(runif(10000))
>>
>> specs <- list()
>> specs$A <- formula(y~x1+x2+x3+x4+x5+x6+x7+x8)
>> specs$B <- specs$A
>> specs$C <- specs$A
>> specs$D <- specs$A
>> specs$E <- specs$A
>> specs$F <- specs$A
>> specs$H <- specs$A
>> specs$I <- specs$A
>> specs$J <- specs$A
>>
>> probits1 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits2 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits3 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits4 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits5 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits6 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits7 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits8 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits9 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits10 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits11 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits12 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits13 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits14 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits15 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits16 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits17 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits18 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits19 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits20 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits21 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits22 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits23 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits24 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits25 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits26 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits27 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits28 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits29 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits30 <- lapply(specs, glm, family=binomial(link="probit"))
>> probits31 <- lapply(specs, glm, family=binomial(link="probit"))
>>
>> --------------010500030900050501010804--
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>



[Rd] a new way to crash R? (PR#8981)
Duncan Murdoch