[R] Error cannot allocate vector of size...

Duncan Murdoch murdoch at stats.uwo.ca
Tue Jan 8 15:40:38 CET 2008


On 1/8/2008 8:49 AM, Rod wrote:
> On Jan 8, 2008 12:41 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>>
>> Rod wrote:
>> > Hello,
>> >
>> > I have a memory problem when I run package WinBUGS with R (2.6.1).
>> > Until now I have been using a Pentium IV 3.2Ghz computer with 512Mb of
>> > RAM memory (with Windows XP Pro SP2), and I hadn't had any problem.
>> > Now I have a new computer with the following characteristics: Intel
>> > Core 2 duo 2.33Ghz and 3Gb of RAM memory (with Windows XP Pro SP2) and
>> > when I am running the same R syntax I receive the following error
>> > message:
>> >
>> > "Error: cannot allocate vector of size 216.0 Mb".
>> >
>> > This is an extract of my R syntax:
>> >
>> >
>> >> memory.limit(4000)
>> >>
>> > NULL
>> >
>> >> simu.BYM<-bugs(data, inits, parameters, model.file="Modelo.txt", n.chains=3, n.iter=200000, n.burnin=20000, n.thin=180, debug=FALSE, DIC=FALSE, digits=5, codaPkg=FALSE, bugs.directory="c:/Archivos de programa/WinBUGS14", working.directory=NULL)
>> >>
>> > Error: cannot allocate vector of size 216.0 Mb
>> >
>> > I have tried:
>> > -Change size of virtual memory inside Windows XP
>> > -change the R memory settings
>> > -run from DOS (R CMD BATCH...)
>> > -reviewed the R Windows FAQ and R-Help.
>> >
>> > but I haven't be able to find a solution !
>> Could you try R-patched?  I recently fixed a minor bug that could have
>> symptoms like this. Under certain conditions it would miscalculate the
>> amount of available memory.  You can download a copy from
>> cran.r-project.org/bin/windows/base/rpatched.html.
>>
>> Duncan Murdoch
>>
> 
> Dear Duncan,
> 
> Thank for your advice. But, the patched version produce the same error.

In that case, you are probably really running out of memory.  It's hard 
to see why this would happen on the larger machine and not the smaller 
one, but perhaps the code tries to adapt itself to available resources. 
  You are likely to have a bit of work diagnosing the problem.

The tools to use are memory.size(), memory.limit() (which report on what 
is available); memory.profile() (which gives more detail on usage). 
Rprofmem() would also be nice, but it's not enabled in the standard 
Windows build.

Duncan Murdoch




More information about the R-help mailing list