Cc1plus.exe: out of memory allocating 65536 bytes

  • Operating System: Microsoft Windows [Version 10.0.17134.345]
  • brms Version: 2.5.0

My brms was working well but suddenly when I try to fit a model it gives me an error saying:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
cc1plus.exe: out of memory allocating 65536 bytes
make: *** [C:/PROGRA~1/R/R-3.5.1/etc/x64/Makeconf:215: file1dd81cc35fce.o] Error 1
In addition: Warning messages:
1: In rstan::stan_model(model_code = x$model, save_dso = save_dso) :
StanHeaders version is ahead of rstan version; update to latest rstan
2: In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-3.5.1/bin/x64/R CMD SHLIB file1dd81cc35fce.cpp 2> file1dd81cc35fce.cpp.err.txt’ had status 1

Apparently, compilation of your model requires too much memory. did you try to fit the model in a fresh R session with other programs closed?

Thanks, @paul.buerkner. I have a brmsfit object that took hours to finish and I was hesitating to restart the session but it seems I have to. Therefore, I will try closing everything and see what happens. Also, just found this solution

adding -flto -ffat-lto-objects to PKG_CPPFLAGS in src/Makevars.win

to a similar problem, so I will also try to implement this solution proposed by @bgoodri and see if I get this problem solved. Otherwise, I will let you know.

Restarting the session was enough to get rid of the error.
Thanks, @paul.buerkner for your great help.