[R] Problems with memory
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Fri Apr 12 14:03:02 CEST 2002
On Fri, 12 Apr 2002, Marlon Martins dos Reis wrote:
> Dear all,
>
> I've started working with R (vs 1041) a few weeks ago, and now I'm
> having problems with the amount of memory.
> I'm working on the windows-me, my computer has 128 Mb of memory. I'm
> using the R under the emacs (ESS-5.1.20) and it is started by the
> command:
> Rterm --min-vsize=10M --max-vsize=100M --min-nsize=500k --max-nsize=1M
The only flag it might be worth using is --max-mem-size (see the rw-FAQ).
Omit all the others.
> I've been had problems when executing a loop like:
> attach("data.Rdata")
> for (i in 1:n)
> {
> object1<-fun1(data...)
> object2<-fun2(...object1)
> object3<-fun3(...object2)
> object4[,i]<-fun4(...object3)
> rm("object1","object2","object3")
> }
> After few interactions it stops with the message:
> "Error: cannot allocate vector of size 7890 Kb
> In addition: Warning message:
> Reached total allocation of 127Mb: see help(memory.size)"
>
> I thought that using "rm" I would avoid problem with memory. Did I miss
> some point on using "rm"? Is there any other way to remove objects from
> the memory?
It's rm(object1, object2, object3) (no quotes).
You've told us very little of what is going on, but as you keep on
re-creating object1 to object3 in the loop, deleting them at the bottom is
almost pointless. If you don't need the objects, why name them?
Just nest the calls.
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list