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

Kirill Müller kirill.mueller at ivt.baug.ethz.ch
Wed May 11 10:42:56 CEST 2016


My ulimit package exposes this API ([1], should finally submit it to 
CRAN); unfortunately this very API seems to be unsupported on OS X 
[2,3]. Last time I looked into it, neither of the documented settings 
achieved the desired effect.


-Kirill


[1] http://krlmlr.github.io/ulimit
[2] 
http://stackoverflow.com/questions/3274385/how-to-limit-memory-of-a-os-x-program-ulimit-v-neither-m-are-working
[3] 
https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getrlimit.2.html


On 10.05.2016 01:08, Jeroen Ooms wrote:
> On 05/05/2016 10:11, Uwe Ligges wrote:
>> 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).
> I found that setting RLIMIT_AS [1] works very well on Linux. But this
> requires that you cap memory to some fixed value.
>
>> library(RAppArmor)
>> rlimit_as(1e9)
>> rnorm(1e9)
> Error: cannot allocate vector of size 7.5 Gb
>
> The RAppArmor package has many other utilities to protect your server
> such from a mis-behaving process such as limiting cpu time
> (RLIMIT_CPU), fork bombs (RLIMIT_NPROC) and file sizes (RLIMIT_FSIZE).
>
> [1] http://linux.die.net/man/2/getrlimit
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list