Bonjour tout le monde.

En C, j'ai besoin de crer un tableau d'unsigned long de 3 milliards de lignes qui nécessiteront donc 24G de RAM.

Avec la déclaration : unsigned long toto[3*1024*1024*1024*sizeof(unsigned long); Ca plante
J'ai donc utilisé la déclaration suivante :

Code C : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
unsigned long *toto;
toto=(unsigned long *)malloc(3*1024*1024*1024*sizeof(unsigned long));
mais ça plante aussi.

Si je me limite à 100 Million, ca passe :

Code C : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
unsigned long *toto;
toto=(unsigned long *)malloc(1*100*1024*1024*sizeof(unsigned long));

La machine possède 64G de RAM et je compile sous Ubuntu avec "g++ -o toto toto.cpp". Comment puis je faire pour créer mon tableau ?

Christophe D.