From mboxrd@z Thu Jan 1 00:00:00 1970 From: martin.kahlert@keksy.mchp.siemens.de (Martin Kahlert) To: help-gcc@gnu.org Subject: Re: memory allocation Date: Thu, 04 Nov 1999 03:00:00 -0000 Message-id: <7vrool$7ak$1@news.mch.sbs.de> References: X-SW-Source: 1999-11/msg00037.html In article < Pine.SGI.4.10.9911040409470.31041-100000@whirlwind.cs.utexas.edu >, Anand Ganesh writes: > Hi, > Why doesnt gcc crib when I make an array declaration that it cant > handle ? > eg > float array[10000][5][5]; > > That there is a problem I realised b'cos some unrelated variables were > getting changed. The reason I declared such an array instead of mallocing > is that it is easier to pass 3D arrays rather than float*** which you cant > use as a 3D array anymore (since dimensions are not known). Then you will probably do out of bound writes inside your code. array is just 5*5*10000*4=1MB in size. There shouldn't be any problem with that. If you get a segfault, then try the shell command limit (i assume you are on Unix-shells here) Hope, that helps, Martin. -- The early bird gets the worm. If you want something else for breakfast, get up later. From mboxrd@z Thu Jan 1 00:00:00 1970 From: martin.kahlert@keksy.mchp.siemens.de (Martin Kahlert) To: help-gcc@gnu.org Subject: Re: memory allocation Date: Tue, 30 Nov 1999 23:28:00 -0000 Message-ID: <7vrool$7ak$1@news.mch.sbs.de> References: X-SW-Source: 1999-11n/msg00037.html Message-ID: <19991130232800.oykgxmrkeTdicV-cd-nMe4BQXMC2UkuyDl7aav6pyBU@z> In article < Pine.SGI.4.10.9911040409470.31041-100000@whirlwind.cs.utexas.edu >, Anand Ganesh writes: > Hi, > Why doesnt gcc crib when I make an array declaration that it cant > handle ? > eg > float array[10000][5][5]; > > That there is a problem I realised b'cos some unrelated variables were > getting changed. The reason I declared such an array instead of mallocing > is that it is easier to pass 3D arrays rather than float*** which you cant > use as a 3D array anymore (since dimensions are not known). Then you will probably do out of bound writes inside your code. array is just 5*5*10000*4=1MB in size. There shouldn't be any problem with that. If you get a segfault, then try the shell command limit (i assume you are on Unix-shells here) Hope, that helps, Martin. -- The early bird gets the worm. If you want something else for breakfast, get up later.