maximum array size?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I wrote a program in gcc. I compile it with the option -m64. Is there a limit in how much memory malloc can allocate? I run the program for different values of some input parameters. The program defines some scalar variables and arrays. Then it defines a large array and tries to set a value in an element of the array.
int **bufferc = malloc((inp_par_a*inp_par_b+2)*sizeof(int *));
int *bufferc_aux = malloc((inp_par_a*inp_par_b+2)*(inp_par_c+1)*sizeof(int));
int bfc=1;
bufferc[bfc]=bufferc_aux+bfc*(inp_par_c+1);
bufferc[bfc][0]=0;
At this point sometimes there is no problem but sometimes I get segmentation fault. There is a lot of unused ram in the server when the problem occurs. Do you think the problem is due to a bug that I have before defining the array?

Thanks,
Anna

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux