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

Mauricio Zambrano hzambran.newsgroups at gmail.com
Wed Jan 19 09:47:44 CET 2011


Thank you very much Hugo for your answer.

Yesterday I was out of my office and I couldn't test the advise you
gave me. Today I'll do it.

I have never used C, so I have to ask.

For creating an executable file with your code, I copied and pasted
the text into a text  file, and then tried from the command  line:

$ gcc memorytest.c  -o memorytes.out

and I got the following warning:

memorytest.c: In function ‘main’:
memorytest.c:5: warning: return type of ‘main’ is not ‘int’

Is this important ?

After your answer, I will execute this program just before the line
that rises the error message, and I'll let you know today.

Thank you very much Hugo,

Cheers,

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

2011/1/18 Hugo Mildenberger <Hugo.Mildenberger at web.de>:
> Hello Mauricio,
>
> Today I lost several messages from r-help and also forgot to
> include you in the reply-to address list previously. I'm curious what the test
> program I already proposed in my answer to r-help reveals. I modified it
> a bit to force the operating system to actually provide the memory. On
> an old 32 bit  notebook with 512 MB of physical RAM having X running
> in parallel, this test program takes about a minute or so, but  eventually
> succeeds.
>
> --- snip ---
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
>
> void main() {
>     const size_t size = 1000000000LU;
>     fprintf(stderr,"Trying to allocate %lu bytes ... ",(unsigned long)size);
>     fflush(stderr);
>     void *p = malloc(size);
>     if ( p ) {
>          fprintf(stderr,"success. Now trying to commit memory ... ");
>          fflush(stderr);
>          memset(p,0,size);
>          fprintf(stderr,"succeeded.\n");
>     }else {
>          fprintf(stderr,"allocation of %lu bytes failed:%m\n",(unsigned long) size);
>     }
> }
>
> --- snip ---
>
> put this into a file named, say, "tmalloc.c" and compile it using
>
>      gcc tmalloc.c -o tmalloc
>
>
> Best regards
>
> Hugo Mildenberger
>



More information about the R-help mailing list