[R] " cannot allocate vector of length 1072693248"

David L. Van Brunt, Ph.D. dvanbrunt at well-wired.com
Fri May 7 18:53:45 CEST 2004


Thanks for the suggestion. If there's a bug in my code, I can't find it.

The code runs successfully several times through. And I have only a few
lines, but repeated in blocks with a few tweaks to make different
predictions each time.

If I comment out a line that preceeds a crash, it will run a little longer
before giving up next time. So it is as if something is slowly filling up
through each run, and is accumulating.

But I do "rm()" all the objects created inside of the "for" loop, and then
gc() before the loop is finished, also.

So I'm stumped.

When I called the debugger, the last item shown was the vector line, so I
chose that option and typed "ls()"... It had only "mode" and "x". The value
of "mode" was "any", and when I tried to display "x", I expected a slew of
data but instead R crashed.

Don't know if that's informative or not!

On 5/7/04 11:42, "Prof Brian Ripley" <ripley at stats.ox.ac.uk> wrote:

> I think it is more likely that you have a bug.  Probably you have run out
> of address space, as that's almost 4Gb if an integer and 8Gb if real.
> 
> Can you do options(error=dump.frames) and debugger() after the error
> message and try to find out what `data' is and what size it is.
> 
> On Fri, 7 May 2004, David L. Van Brunt, Ph.D. wrote:
> 
>> Well, I've done everything I can think of the make the code more efficient,
>> but it seems (if I read this error message correctly) that I'm running out
>> of memory on what should be small data set.
>> 
>> Here's the sequence:
>> 
>> A vector of 30 possible identifiers
>> For each value, query a MySQL database to pull in 80 or so records
>> Run a few different random Forests on those data
>> Print the results as I go
>> "rm()" all the objects created in the loop, including all the old data
>> Next value, to repeat for each identifier.
>> 
>> 
>> Round the 3rd time through the loop, I get kicked out with:
>> 
>> "Error in as.vector(data) : cannot allocate vector of length 1072693248"
>> 
>> This is on Mac OS X, which is UNIX-based (from freeBSD, as I understand it),
>> so I haven't set anything special with the memory at startup. But then, I
>> only have 80 observations running through at a time, so it doesn't seem like
>> there should be a memory issue.
>> 
>> Any ideas?
>> 
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>> 
>> 

-- 
David L. Van Brunt, Ph.D.
Outlier Consulting & Development
mailto: <ocd at well-wired.com>




More information about the R-help mailing list