Hello, thank you everybody for your help. I used malloc to create my arrays instead of creating the in the stack. My program is working now but it is very slow.
I use two-dimensional arrays. The way I access element (i,j) is: array_name[i*row_length+j] The server that I use has 16GB ram. The ulimit -a command gives the following output: time(seconds) unlimited file(blocks) unlimited data(kbytes) unlimited stack(kbytes) 8192 coredump(blocks) unlimited nofiles(descriptors) 256 vmemory(kbytes) unlimited Do you have any suggestions to speed up my program? Anna ----- Original Message ----- From: "Anandkumar, CB IN BLR SISL" <[EMAIL PROTECTED]> Date: Friday, November 14, 2008 8:53 am Subject: RE: RE: change to gcc from lcc > Hi Anna, > On debugging your code I found that it is problem with the local > memory being allocated. Currently you are reserving > 250*1000000*4(953MB)bytes of memory . But if I reduce it to say > 250*10000*4 bytes things seem to work fine. > > BTW did you give option -g for compilation so debug symbols will > be present in the elf for debugging. > > ex:- gcc -g -o test test.c > > refer to this site for more information regarding size limit > problems. > > > http://www.linuxquestions.org/questions/programming-9/c-array-size- > limit-282519/\ > > But why do you need such a huge static array. > > why don't you use dynamic memory allocation mechanism , so you > will get to know the memory allocation problem at runtime itself. > > With regards, > Anandkumar.C.B > > > > -----Original Message----- > From: Anna Sidera [mailto:[EMAIL PROTECTED] > Sent: Friday, November 14, 2008 9:58 AM > To: Anandkumar, CB IN BLR SISL > Subject: Re: RE: change to gcc from lcc > > I need to define many variables that need a lot of space. I > thought that > maby there is memory problem. Maby gcc needs special options to > reservemore temporary memory. > > If you know anything pleas help. > > Also when I run: > > gdb a.out > > I get: > > GNU gdb 6.0 > Copyright 2003 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, > and you > are welcome to change it and/or distribute copies of it under certain > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for > details. > This GDB was configured as "sparc-sun-solaris2.8"...(no debugging > symbols found)... > Bus error (core dumped) > > and the gdb session ends > > > > > > > > Hello, > > I am sending you the code. > > #include <stdio.h> > #include <math.h> > #include <stdlib.h> > #include <time.h> > int main() > { > int i, j; > int buffer1[250][1000000]; > for (i=0; i<250; i++) { > for (j=0; j<1000000; j++) { > buffer1[i][j]=0; > } > } > printf("\nThe program finished successfully\n"); return 0; } > > Many Thanks, > Anna > > > ----- Original Message ----- > From: "Anandkumar, CB IN BLR SISL" <[EMAIL PROTECTED]> > Date: Thursday, November 13, 2008 4:03 am > Subject: RE: change to gcc from lcc > > > > > Hi Anna, > > Can you send the code which is currently giving segmentation > fault. > > Did you try to debugging the code using GDB . If you have not > done yet > > > can you try debugging through GDB and find out as on > executingwhat > > section of code you are getting the segmentation fault. > > > > what can you send the core dumped information. > > > > With regards, > > Anandkumar.C.B > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:gcc-help- > [EMAIL PROTECTED] > > On Behalf Of Anna Sidera > > Sent: Thursday, November 13, 2008 5:07 AM > > To: [EMAIL PROTECTED] > > Subject: change to gcc from lcc > > > > Hello, > > > > I wrote a program in lcc in windows and now I have to write it > in gcc > > in unix. In lcc the program works. It uses the following libraries. > > > > #include <stdio.h> > > #include <math.h> > > #include <stdlib.h> > > #include <time.h> > > > > In gcc I run the program as follows > > > > gcc -lm program.c > > > > but I get > > > > segmentation fault (core dumped) > > > > Can you please advise me on this? > > > > Many Thanks > > Anna > > > > > > > > > > Important notice:This e-mail and any attachment thereto contains > > corporate proprietary information. If you have received it by > mistake, > > please notify us immediately by reply e-mail and delete this e- > mail > > and its attachments from your system. Thank You. > > > > > > > Important notice:This e-mail and any attachment thereto contains > corporate proprietary information. If you have received it by > mistake, please notify us immediately by reply e-mail and delete > this e-mail and its attachments from your system. Thank You. >