[R] huge array with floats: allocation error
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Aug 16 18:31:56 CEST 2004
On Mon, 16 Aug 2004, Christoph Lehmann wrote:
> After searching through a couples of documents and the mailing list I
> dare to ask it here
I don't believe you read the rw-FAQ as the posting guide asks, though.
You seem to be working under Windows, without saying so (and the posting
guide does ask you to). So that's `a couples of documents' worth
> I need to define an array with the size 64 x 64 x 16 x 1000 for
> single-precision floating-point numbers. With 1G RAM I get always the
> "cannot allocate vector of size 458752 Kb"
> "reached total allocation of 1022MB: see help(memory.size)"
> I consulted memory.size() but it didn't help me.
This *is* covered in the rw-FAQ, as well as on that help page, viz
Command-line flag '--max-mem-size' sets the maximum value of
obtainable memory (including a very small amount of housekeeping
> so my question: I know that there is NO float type in R. Is there any
> way to solve my problem, without increasing the RAM?
Your array has 65 million numbers. That's well under the size of your RAM
in R's doubles (500MB). And
> x <- rep(0, 64 * 64 * 16 * 1000)
> dim(x) <- c(64,64,16,1000)
does work on a 1Gb Windows machine, so your problem is in however (you
didn't tell us) you were trying to do it. Again, see the posting guide.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help