0

Hi I have a problem with the memory in RStudio.

I have imported in the Global Env many large data frames and a certain point I get this error:

Error: vector memory exhausted (limit reached?) 

So after that I cannot import any additional files or perform any operation on those data frames which I would like to do.

Another thing that came to my mind is to import half of those data frames and put in a list perform the operation on the list for just half of them. However after putting them in a list, I cleared the Global Env of those objects however even after removing them from the Global Env I still get the same error and if I do gc() still I am not able to clear the memory:

used         (Mb) gc trigger    (Mb) limit (Mb)     max    used    (Mb)
Ncells   20758418  1108.7   67618782  3611.3         NA   20758418  1108.7
Vcells 1885547953 14385.6 2132002895 16265.9      16384 1885547953 14385.6 

I don't want to restart the R session because then otherwise the list containing the df will be gone. Any suggestion highly appreciated.

Paolo Lorenzini
  • 579
  • 2
  • 15
  • 1
    Possible duplicate of [Error: vector memory exhausted (limit reached?) R 3.5.0 macOS](https://stackoverflow.com/questions/51248293/error-vector-memory-exhausted-limit-reached-r-3-5-0-macos) – phiver Dec 21 '18 at 09:45
  • 1
    Save the list containing data frames to a file using `saveRDS(object, file = "")`, restart R and open it with [readRDS](https://www.rdocumentation.org/packages/base/versions/3.5.1/topics/readRDS) – Paul Rougieux Dec 21 '18 at 09:48
  • you can change the memory limit size, see ?memory.size for more info. – Yaroslaw Homenko Dec 21 '18 at 09:48
  • @phiver I followed what that post said, still I got the same error, it is not working – Paolo Lorenzini Dec 21 '18 at 09:48
  • @PaulRougieux thank you very much, I can try to do that – Paolo Lorenzini Dec 21 '18 at 09:48
  • 1
    If you have a 64bit machine with 64bit R, your memory.limit should be the full size of the available memory of your machine. If you exceed that, you will run into problems. you might want to look into bigmemory and related packages. – phiver Dec 21 '18 at 10:01
  • @phiver I see, I am checking the bigmemory package, it seems useful, thanks – Paolo Lorenzini Dec 21 '18 at 10:11

0 Answers0