Skip to content
Prev 65448 / 398502 Next

vector memory allocation?

Hi all,

I have a vector size allocation problem with R 2.0.1 (script and output 
shown):

 > var1 <- sum (input1 * input2, na = TRUE)

 > gc()
           used  (Mb) gc trigger   (Mb)
Ncells   199327   5.4     785113   21.0 
Vcells 71039552 542.0  206003790 1571.7

 > var2 <- sum (input1 * input2 / input2, na = TRUE)

Error: cannot allocate vector of size 524288 Kb

input1 and input2 are matrices input from text files of about 100 MB.

This error happens irrespective of whether I calculate var1 or var2 
first...it will always calculate the first and always have an error on 
the second. Am I misusing the garbage-collector? I am confused by the 
fact that the difference between 'trigger' and 'used' seems so much 
higher than the size of vector that it says it can't allocate.


thanks, Sam Yeaman