Quantcast

Cannot allocate vector of size x

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Cannot allocate vector of size x

Michael Haenlein
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cannot allocate vector of size x

Rubén Roa
Check one of the examples in

?try

It has this heading:

## run a simulation, keep only the results that worked.

If your system is Windows, you can also try to increase the memory available for one application, in order to avoid the problem.
Do a search for "3GB switch"

HTH

Dr. Ruben H. Roa-Ureta
Senior Researcher, AZTI Tecnalia,
Marine Research Division,
Txatxarramendi Ugartea z/g, 48395, Sukarrieta,
Bizkaia, Spain

-----Mensaje original-----
De: [hidden email] [mailto:[hidden email]] En nombre de Michael Haenlein
Enviado el: miércoles, 21 de septiembre de 2011 11:54
Para: [hidden email]
Asunto: [R] Cannot allocate vector of size x

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]]

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cannot allocate vector of size x

jholtman
In reply to this post by Michael Haenlein
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 <[hidden email]> 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]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cannot allocate vector of size x

Rubén Roa
Yes, on a recent heavy-duty job -profile likelihood of Tweedie power parameter for a relatively complex glm with hundreds of thousands rows dataframe- I had the "cannot allocate vector ..." error, then I just closed-saved the main workspace, full of large objects, then I did the profiling on a fresh and almost empty (with strictly necessary objects) workspace, and it run successfully. Then I just loaded the two workspaces to one session,  and continued happily to the end of the job. :-)

Dr. Ruben H. Roa-Ureta
Senior Researcher, AZTI Tecnalia,
Marine Research Division,
Txatxarramendi Ugartea z/g, 48395, Sukarrieta,
Bizkaia, Spain

-----Mensaje original-----
De: [hidden email] [mailto:[hidden email]] En nombre de Jim Holtman
Enviado el: miércoles, 21 de septiembre de 2011 12:11
Para: Michael Haenlein
CC: [hidden email]
Asunto: Re: [R] Cannot allocate vector of size x

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 <[hidden email]> 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]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.
Loading...