[R] "cannot allocate vector of size ..." in RHLE5 PAE kernel

Mauricio Zambrano hzambran.newsgroups at gmail.com
Wed Jan 19 14:55:45 CET 2011


Thanks again Hugo,

2011/1/19 Hugo Mildenberger <Hugo.Mildenberger at web.de>:
> Dear Mauricio,
>
> what I do not understand at all is the message:
>
>> Error: cannot allocate vector of size 476.2 Mb
>
> Have you tried to allocate a big matrix in between, whith
> the R - statement not being shown in the output?

If I understood correctly your question, in between the lines I showed
you before:

  print(gc())
  print(gcinfo(TRUE))
  system("/dataMZB/2011/memorytest.out")

I didn't try to allocate a matrix, and the R output was a message
printed just before those three lines.

> Probably not. If not, your local R version is buggy for sure. The test shows
> that the OS imposes no artificial constraint on memory consumption,
> at least not up to ~ 1GB. But because you said that you're running a
> 32 - bit version of R (in a virtual machine?),

I'm running a 32 bits OS in a 64 bits hardware, by using a kernel with
PAE  extension, in order to see the 12 Gb of ram that I have:

$ uname -a
Linux mymachine 2.6.18-238.el5PAE #1 SMP Sun Dec 19 14:42:44 EST 2010
i686 i686 i386 GNU/Linux

>  the question is now wether gcc also compiles the test program as a 32 - bit program. I'm
> unsure because a 64 - bit system can be configured to compile and
> run programs using either environment. Regrettably I previously
> did not include a test for that.
>
> --- snip ---
> #include <stdio.h>
> int main() {
>        printf("The size of a pointer is %lu bytes\n", (unsigned long)sizeof(void *));
>        return 0;
> }
> --- snip ---

The output of that program was:

"The size of a pointer is 4 bytes"

so, I confirmed that I'm running a 32 bits OS.

>
> If the program says "The size of a pointer is 4 bytes" then you're
> running the test program in a 32 bit environment.  Then the
> allocation problem could possibly be solved by recompiling/updating
> your R version.

I think is the right way of solving this.

At the other hand, yesterday a friend suggested me to install R in a
live CD with a 64 GNU/Linux OS, to run my script and see if I get the
same error. I'll also try this.

> The system is called Redhat "Enterprise" Linux after all, so  calling in Redhat support at that point and ask them to do
> something for their money should be an option.

What is sadly funny, is the fact that when I asked the IT guys of my
work if it is possible to ask support for "software"
compilation/installation in RHLE, they told me that is NOT possible,
because the money they are paying in licences is for network
maintenanceand other corporative stuff.

So far, RHLE only have brought problems to me (this is one of "many"),
problems that I never had while using Ubuntu, but unfortunately at
work RHEL was the only possible choice.

I'll let you know if I'm able to overcome this issue.

Thanks a lot for your help,

Cheers,

Mauricio

-- 
===============================
Linux user #454569 -- Ubuntu user #17469
===============================

>
> Best
>
> Hugo
>
>
>
> On Wednesday 19 January 2011 12:54:38 Mauricio Zambrano wrote:
>> Dear Hugo,
>>
>> I tried your memory test program (without further modifications) just
>> after the gc() command:
>>
>> print(gc())
>> print(gcinfo(TRUE))
>> system("/mypath/memorytest.out")
>>
>> and the result that I got was:
>>
>> Number of simulations read from ' Particles.txt ' : 9000
>> -------------------------------------------------------------------
>>           used (Mb) gc trigger  (Mb)  max used   (Mb)
>> Ncells  480114 12.9    1816453  48.6   5543382  148.1
>> Vcells 5256970 40.2  119171871 909.3 322607910 2461.4
>> [1] TRUE
>> Trying to allocate 1000000000 bytes ... success. Now trying to commit
>> memory ... succeeded.
>> Garbage collection 2667 = 2286+194+187 (level 2) ...
>> 12.9 Mbytes of cons cells used (26%)
>> 278.4 Mbytes of vectors used (29%)
>> Error: cannot allocate vector of size 476.2 Mb
>>
>> What do you understand of this result ?
>>
>> Thanks in advance,
>>
>> Mauricio
>>
>> >> I got the following warning:
>> >>   memorytest.c: In function ‘main’:
>> >>   memorytest.c:5: warning: return type of ‘main’ is not ‘int’
>> >> Is this important ?
>> >
>> > Hello Mauricio,
>> >
>> > No, your gcc version is unduly puristic here. The traditional return
>> > type of the main function in "C" should be "int", and if that is given,
>> > main has to return an integer number explicitly. By convention,
>> > a main function returning 0 indicates success, and anything other
>> > is considered as an error or warning condition. Specifying "void main()"
>> > normally implies returning zero. But if you are still worried simply
>> > change "void main" into "int main()" and add the statement " return 0; "
>> > just before the last curly bracket (without quotation marks, of course):
>> >
>> >  int main() {
>> >       [...]
>> >       return 0;
>> > }
>> >
>> > Best
>> >
>> > Hugo
>> >
>>
>



More information about the R-help mailing list