public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* maximum array size?
@ 2010-04-15  9:17 Anna Sidera
  2010-04-15 10:17 ` Brian Budge
  2010-04-15 15:31 ` John S. Fine
  0 siblings, 2 replies; 7+ messages in thread
From: Anna Sidera @ 2010-04-15  9:17 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-16 12:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15  9:17 maximum array size? Anna Sidera
2010-04-15 10:17 ` Brian Budge
2010-04-15 12:43   ` Brian Budge
2010-04-15 15:31 ` John S. Fine
     [not found]   ` <f61380541765a.4bc757a9@ucy.ac.cy>
2010-04-15 16:00     ` John S. Fine
2010-04-16 13:48       ` Anna Sidera
2010-04-16 13:51       ` Anna Sidera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).