[Rd] .Internal(quit(...)): system call failed: Cannot allocate memory

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sat Nov 21 20:40:12 CET 2020

On 21/11/2020 12:51 p.m., Jan Gorecki wrote:
> Dear R-developers,
> Some of the more fat scripts (50+ GB mem used by R) that I am running,
> when they finish they do quit with q("no", status=0)
> Quite often it happens that there is an extra stderr output produced
> at the very end which looks like this:
> Warning message:
> In .Internal(quit(save, status, runLast)) :
>    system call failed: Cannot allocate memory
> Is there any way to avoid this kind of warnings? I am using stderr
> output for detecting failures in scripts and this warning is a false
> positive of a failure.
> Maybe quit function could wait little bit longer trying to allocate
> before it raises this warning?

I don't know what waiting would accomplish.  Generally speaking the 
allocation functions in R will try garbage collection before failing, so 
it looks like you are in a situation where there really is no memory 
available.  (I think code can prevent gc; maybe your code is doing that 
and not re-enabling it?)

Having a reproducible example would help, but I imagine it's not easy to 
put one together.

Duncan Murdoch

More information about the R-devel mailing list