32 bit windows has a memory limit of 2GB.  Upgrading to a computer thats
less than 10 years old is the best path.

But short of that, if you're just generating random data, why not do it in
two or more pieces and combine them later?

mat.1 <- matrix(rnorm(50000*2000),nrow=50000)
mat.2 <- matrix(rnorm(50000*2000),nrow=50000)
mat.3 <- matrix(rnorm(50000*2000),nrow=50000)

mat.1.sums <- rowSums(mat.1)
mat.2.sums <- rowSums(mat.2)
mat.3.sums <- rowSums(mat.3)

mat.sums <- c(mat.1.sums,mat.2.sums,mat.3.sums)



On Wed, Feb 8, 2012 at 8:37 AM, Christofer Bogaso <
bogaso.christofer@gmail.com> wrote:

> 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,
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

