Forcing R (and Rstudio) to use the virtual memory on Windows

后端 未结 1 1421
一整个雨季
一整个雨季 2020-12-05 05:35

I\'m working with large datasets and quite often R produces an error telling it can\'t allocate a vector of that size or it doesn\'t have enough memory.

My compu

相关标签:
1条回答
  • 2020-12-05 06:12

    In order to get it working automatically every time you start RStudio the solution with R_MAX_MEM_SIZE is ignored, both if created as an environment variable or if created inside the .Rprofile.

    Writing memory.limit(64000) is ignored too.

    The proper way is adding the following line in the file .Rprofile

    invisible(utils::memory.limit(64000))
    

    or whatever number you want.

    Of course you need to have a pagefile big enough. That number includes free RAM and free pagefile space.

    Using the pagefile is slower but it's going to be used only when needed.

    Something strange I've found is that it only let's you increase the maximum memory to use but it doesn't allow you to decrease it.

    0 讨论(0)
提交回复
热议问题