1
> adj = as.dist(adj)
Error: cannot allocate vector of size 3.0 Gb

> system("free -h")
              total        used        free      shared  buff/cache   available
Mem:            14G        2.2G         12G         88M        420M         12G
Swap:            0B          0B          0B

> gc()
           used  (Mb) gc trigger   (Mb)   max used    (Mb)
Ncells  7799796 416.6   16746142  894.4   16746142   894.4
Vcells 41146681 314.0  520945812 3974.6 1665927139 12710.1

Why can't I allocate a vector of 3.0GB if I have 12GB free? I'm working on Linux CentOS, so I don't have access to memory.limit() and memorize.size().

This general question has been asked a lot. I don't see an answer that addresses my specific question, though. These questions are kind of the same, but the only answers I see are related to reducing the size of the object, using memory.limit() and memory.size(), or using bsub -q server_name -R. I don't know how to use the latter inside a script, and it doesn't address my question of why I can't allocate a vector when (it appears) I have the memory to do so. I've also tried including Sys.setenv('R_MAX_VSIZE'=32000000000) but that did not fix it.

Edit: I added gc() output. Does it matter that the available 12GB are virtual memory??

R Greg Stacey
  • 425
  • 4
  • 15

0 Answers0