[R] Memory allocation problem (again!)

Christofer Bogaso bogaso.christofer at gmail.com
Wed Feb 8 17:37:13 CET 2012


Dear all, I know this problem was discussed many times in forum, however
unfortunately I could not find any way out for my own problem. Here I am
having Memory allocation problem while generating a lot of random number.
Here is my description:

> rnorm(50000*6000)
Error: cannot allocate vector of size 2.2 Gb
In addition: Warning messages:
1: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
2: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
3: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
4: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
> memory.size(TRUE)
[1] 15.75
> rnorm(50000*6000)
Error: cannot allocate vector of size 2.2 Gb
In addition: Warning messages:
1: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
2: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
3: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)
4: In rnorm(50000 * 6000) :
  Reached total allocation of 1535Mb: see help(memory.size)

And the Session info is here:

> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252    

attached base packages:
[1] graphics  grDevices utils     datasets  grid      stats     methods
base     

other attached packages:
[1] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.6      zoo_1.7-6    

loaded via a namespace (and not attached):
[1] lattice_0.20-0

I am using Windows 7 (home version) with 4 GB of RAM (2.16GB is usable as my
computer reports). So in my case, is it not possible to generate a random
vector with such length? Note that generating such vector is my primary job.
Later I need to do something on that vector. Those Job includes:
1. Create a matrix with 50,000 rows.
2. Get the row sum
3. then report some metrics on that sum values (min. 50,000 elements must be
there).

Can somebody help me with some real solution/suggesting?

Thanks and regards,



More information about the R-help mailing list