From pgilbert at bank-banque-canada.ca  Thu Oct  9 13:09:02 2003
From: pgilbert at bank-banque-canada.ca (Paul Gilbert)
Date: Thu Oct  9 18:04:14 2003
Subject: [Rd] exceeding memory causes crash on Linux
In-Reply-To: <3F858393.9000704@bankofcanada.ca>
References: <3F857954.3020808@bankofcanada.ca>
	<3F858393.9000704@bankofcanada.ca>
Message-ID: <3F85881E.1060102@bankofcanada.ca>

Paul Gilbert wrote:

>> I am having an unusual difficulty with R 1.8.0 on Mandrake 9.1 
>> running a problem that takes a large amount of memory. With R 1.7.1  
>> this ran on the machine I am using (barely), but now takes more 
>> memory than is available.  The first two times I tried with R 1.8.0, 
>> R exited after the program had run for some time, and gave no 
>> indication of anything, just returned to the shell command prompt. I 
>> ran under gdb to see if I could get a bettter indication of the 
>> problem, and this crashed Linux completely, or at least X, but I 
>> couldn't get another console either. (I haven't had anything crash 
>> Linux in a long time.) To confirm this I ran R under gdb again, and 
>> ran top to verify I was hitting memory constraints (which I was), but 
>> this time R did give a message "Error: cannot allocate a vector of 
>> size ..." 
>
>
> P.S. But there does not seem to be proper garbage collection after 
> this. Top showed the memory still in use and subsequent attempts to 
> run the program failed immediately trying to allocate a much smaller 
> vector. When I did gc()  explicitely it did clean up and I could start 
> the function again. The second time R exited back to the gdb prompt 
> with a message "Program terminated with signal  SIGKILL, Killed. The 
> program no longer exists." 

P.P.S. I can reproduce this (at least the SIGKILL part) on a machine 
with 500MB memory and swap turned off simply with
    z <- rnorm(50000000)
(Turning off swap is simply to make the failure happen quickly rather 
than slowly on a bigger problem.)

>
>
>> I'm not worried about running the problem, but I would like a more 
>> graceful exit. Might this be related to the change in error handling?
>>
>> Paul Gilbert
>>
>> ______________________________________________
>> R-devel@stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>>
>


[Rd] exceeding memory causes crash on Linux
Paul Gilbert