to allocate 7.8 MB to a vector? (on R running on MacOS 8.6 with a 100MB partition) I get this error from a function which is trying to create a 1000x1000 matrix: Error: cannot allocate vector of size 7812 Kb the error occurs here: dist <- as.single((t(pos)-pos)/n) where pos is a matrix of integers, and n is the size of the first dimension. It appears to first create a double with (t(pos)-pos)/n, running out of memory before making it a single. Several questions arise from this problem: 1) how do I determine how much memory is free within the program?, 2) how do I determine how much memory is being consumed by a given object?, 3) how do I force R to create a matrix as a single rather than a double? daver +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |David Richmond It works on a | + Dept. of Sociology complex scientific + |Saint Mary's College principle, known as | + Notre Dame, IN 46556 "pot luck." + |219-284-4517 - The Doctor | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 29 Sep 2001, David A Richmond wrote:> > Several questions arise from this problem: 1) how do I determine how much > memory is free within the program?, 2) how do I determine how much memory > is being consumed by a given object?, 3) how do I force R to create a > matrix as a single rather than a double?1) gc() or memory.profile() 2) Not well-defined in general, but for a matrix it is usually 8 bytes per element for real, 4 for integer (plus a fairly small fixed overhead). 3) You don't. R doesn't have single precision. as.single() is just a request that when the object is passed to .C or .Fortran it should be converted to single precision. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._