The matrix you are trying to produce is 763 MB in size > (10000 * 10000 * 8)/(1024 * 1024) [1] 762.9395
because it will be stored as double precision floating point numbers. If it is sufficient to have the result as an integer matrix you can cut its size in half by changing the first argument to c(-1L, 1L). In general you should expect R to use a small number (say < 5) copies of the object you wish to create during its construction so you are probably using several gigabytes of memory here and you may be seeing swapping. On Thu, Jul 28, 2011 at 4:22 PM, Paul Menzel <[email protected]> wrote: > Package: r-base > Version: 2.13.1-1 > Severity: important > > Dear Debian folks, > > > The following command reliably freezes my system after one or two > seconds and the only way to recover is to cold reset the system. > > > n = 10000 > > length = 10000 > > R = matrix(sample(c(-1,1),length*n,replace=T),nrow=n) > > Trying this on a different system (totally different) running Debian > Squeeze, i. e. R version 2.11.1-6, I get an error message though. > > > n = 10000 > > length = 10000 > > R = matrix(sample(c(-1,1),length*n,replace=T),nrow=n) > Error: cannot allocate vector of size 762.9 Mb > > First I suspected RAM/memory problems because the RAM fills up pretty > quickly, but Memtest86+ did not reveal any errors. Additionally I am > still running `linux-image-2.6.32-5-amd64` (2.6.32-31) because of bug > #613979, but that should not cause any problems. > > It would be great if you could advise me of how to continue to solve > this problem. > > > Thanks, > > Paul > > > [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613979 > > -- System Information: > Debian Release: wheezy/sid > APT prefers unstable > APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') > Architecture: i386 (x86_64) > > Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores) > Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) > Shell: /bin/sh linked to /bin/bash > > Versions of packages r-base depends on: > ii r-base-core 2.13.1-1 GNU R core of statistical > computat > ii r-recommended 2.13.1-1 GNU R collection of recommended > pa > > Versions of packages r-base recommends: > ii r-base-html 2.13.1-1 GNU R html docs for statistical > co > ii r-doc-html 2.13.1-1 GNU R html manuals for > statistical > > Versions of packages r-base suggests: > pn ess <none> (no description available) > pn r-doc-info | r-doc-pdf <none> (no description available) > > -- no debconf information > -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

