[Beowulf] 8GB memeory limit?

Martin Siegert siegert at sfu.ca
Tue Jul 10 17:11:50 PDT 2007


Hi,

I am running into a bizarre memory issue: I do not appear to be
able to allocate 8GB of memory into a single array:

===<int_malloc.c>================================================
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]){
long int i, n;
long int *m;

   n = 1024*1024*1024*sizeof(long int);
   for (i = 1; i <= n; i*=2) {
      m = (long *) malloc(i);
      if (m == NULL) {
         fprintf(stderr, "allocation of %li bytes failed.\n", i);
         exit(-1);
      }
      free(m);
   }
}
===</int_malloc>=================================================

# gcc -m64 int_malloc.c
# ./a.out
allocation of 8589934592 bytes failed.

This is with a 2.6.5 kernel (SLES 9).
If I compile the same program under kernel 2.6.16.27 (openSuSE 10.2),
the program completes without problem.

Under either OS I can allocate, e.g., 5 arrays of 4GB each within the
same program without problem.

Where does this limit of 8GB for a single array come from?
Is it in the kernel? If yes, can it be changed, e.g., through a sysctl?
Which one?

Cheers,
Martin

-- 
Martin Siegert
Head, HPC at SFU
WestGrid Site Lead
Academic Computing Services                phone: (604) 291-4691
Simon Fraser University                    fax:   (604) 291-4242
Burnaby, British Columbia                  email: siegert at sfu.ca
Canada  V5A 1S6



More information about the Beowulf mailing list