This is related to the question of how to increase the memory limit on macOS, “R on MacOS Error: vector memory exhausted (limit reached?)”. I was wondering, is there some way to read this value in R so that my program can adapt to the upper bound during execution instead of running into a memory limit error?
I understand that the value can be set in an .Renviron
file but I am not sure if this file is always in the same location, or if it is even required in all cases…
Yes, R_MAX_VSIZE
is an environment variable so you can access it using Sys.getenv()
.
> Sys.getenv("R_MAX_VSIZE")
100Gb
This is also related to the R question about accessing environment variables: “How can I make R read my environmental variables?”