D
Diego Andres Alvarez Marin
Hi!
I have problems with memory allocation of matrices bigger than 4 Mb.
So, here is the example:
#include <stdlib.h>
#include <stdio.h>
#define M 2000
#define N 2000
/*
Compile with:
gcc -Wall -O3 crash.c -o crash
*/
int main(){
int i,j;
double A[M][N];
for (i=0; i<M; i++) for (j=0; j<N; j++) A[j] = (double)i+j;
return EXIT_SUCCESS;
}
In the command line:
[daa@ysh06-8-13 r4]$ gcc -Wall -O3 crash.c -o crash
[daa@ysh06-8-13 r4]$ ./crash
Segmentation fault
[daa@ysh06-8-13 r4]$
My PC has 512 Mb RAM and this matrix has only 16 Mb.
How can I allocate this matrix?
Thanks a lot in advance!
Diego Andres
I have problems with memory allocation of matrices bigger than 4 Mb.
So, here is the example:
#include <stdlib.h>
#include <stdio.h>
#define M 2000
#define N 2000
/*
Compile with:
gcc -Wall -O3 crash.c -o crash
*/
int main(){
int i,j;
double A[M][N];
for (i=0; i<M; i++) for (j=0; j<N; j++) A[j] = (double)i+j;
return EXIT_SUCCESS;
}
In the command line:
[daa@ysh06-8-13 r4]$ gcc -Wall -O3 crash.c -o crash
[daa@ysh06-8-13 r4]$ ./crash
Segmentation fault
[daa@ysh06-8-13 r4]$
My PC has 512 Mb RAM and this matrix has only 16 Mb.
How can I allocate this matrix?
Thanks a lot in advance!
Diego Andres