From ripley at stats.ox.ac.uk  Thu May  5 11:39:37 2016
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 5 May 2016 10:39:37 +0100
Subject: [Rd] R process killed when allocating too large matrix (Mac OS
	X)
In-Reply-To: <2fa1c8e2-c692-1237-ea3c-572397038b26@statistik.tu-dortmund.de>
References: <CAM3-KjYqc5CvDt4yKkOEPw--1Fq-c8O8x6UfFir5x==-UwFYvw@mail.gmail.com>
	<0e0160ec793649dda463b43d7e7d5c37@CONNHUB1.connect.uwaterloo.ca>
	<CAM3-Kja40deG=04U+PDNjLD=sHzQRiz_umia+wBEP77YyW5qQA@mail.gmail.com>
	<9b3da5c7758b455baad7209384abe7a7@CONNHUB4.connect.uwaterloo.ca>
	<CAM3-KjZ13TOz7x6DC+F1=9WsJFHbz4Ay0gf-fhQOv84oSRiE=w@mail.gmail.com>
	<308D9A3B-C40F-4AF7-AF1A-43DC8E1130EF@r-project.org>
	<572AA6AF.9040400@fredhutch.org>
	<3e8b8d2d46ac440892d2055c502b5be9@CONNHUB1.connect.uwaterloo.ca>
	<CAM3-KjbDejim0PSj9s5ognw4wfA=_BvD2UmfVDdmixqww2MkoA@mail.gmail.com>
	<2fa1c8e2-c692-1237-ea3c-572397038b26@statistik.tu-dortmund.de>
Message-ID: <572B14D9.3050005@stats.ox.ac.uk>

On 05/05/2016 10:11, Uwe Ligges wrote:
>
>
> On 05.05.2016 04:25, Marius Hofert wrote:
>> Hi Simon,
>>
>> ... all interesting (but quite a bit above my head). I only read
>> 'Linux' and want to throw in that this problem does not appear on
>> Linux (it seems). I talked about this with Martin Maechler and he
>> reported that the same example (on one of his machines; with NA_real_
>> instead of '0's in the matrix) gave:
>>
>>   Error: cannot allocate vector of size 70.8 Gb
>>     Timing stopped at: 144.79 41.619 202.019
>>
>> ... but no killer around...
>
> Well, with n=1. ;-)
>
> Actually this also happens under Linux and I had my R processes killed
> more than once (and much worse also other processes so that we had to
> reboot a server, essentially). That's why we use job scheduling on
> servers for R nowadays ...

Yes, Linux does not deal safely with running out of memory, although it 
is better than it was.  In my experience, only commercial Unices do that 
gracefully.

Have you tried setting a (virtual) memory limit on the process using the 
shell it is launched from?  I have found that to be effective on most 
OSes, at least in protecting other processes from being killed. 
However, some things do reserve excessive amounts of VM that they do not 
use and so cannot be run under a sensible limit.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



[Rd] R process killed when allocating too large matrix (Mac OS X)
Prof Brian Ripley