[R] Cannot allocate vector of size x

Jim Holtman jholtman at gmail.com
Wed Sep 21 12:10:43 CEST 2011


how much memory do you have on your system? How large are the vectors you are creating? How many other large vectors do you have in memory?  Remove all unused objects and do gc() to reclaim some of the memory. Remember all objects are in memory and you have to understand how large they are and how many you have. Ther is more information you have to provide and some more inspection you have to do.

Sent from my iPad

On Sep 21, 2011, at 5:53, Michael Haenlein <haenlein at escpeurope.eu> wrote:

> Dear all,
> 
> I am running a simulation in which I randomly generate a series of vectors
> to test whether they fulfill a certain condition. In most cases, there is no
> problem. But from time to time, the (randomly) generated vectors are too
> large for my system and I get the error message: "Cannot allocate vector of
> size x".
> 
> The problem is that in those cases my simulation stops and I have to start
> it again manually. What I would like to do is to simply ignore that the
> error happened (or probably report that it did) and then continue with
> another (randomly) generated vector.
> 
> So my question: Is there a way to avoid that R stops in such a case and just
> restarts the program from the beginning as if nothing happened?
> I hope I'm making myself clear here ...
> 
> Thanks,
> 
> Michael
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list