D - big arrays.
- Mikael Haapakoski (3/3) May 10 2005 while i tried to make int array[1000][1000][1000] compiler gave error,
- Thomas (4/7) May 10 2005 Note:
- Derek Parnell (19/22) May 10 2005 Maybe because static arrays are created on the stack, your application
while i tried to make int array[1000][1000][1000] compiler gave error, with array litlle bigger than [510][510][2] compiler halts. why so? if i want to use arrays such big, do i have to use malloc?
May 10 2005
Mikael Haapakoski schrieb am Tue, 10 May 2005 17:41:11 +0300:while i tried to make int array[1000][1000][1000] compiler gave error, with array litlle bigger than [510][510][2] compiler halts. why so? if i want to use arrays such big, do i have to use malloc?Note: Please post to the "digitalmars.D.learn" newsgroup instead of the depricated "D" group.
May 10 2005
On Tue, 10 May 2005 17:41:11 +0300, Mikael Haapakoski wrote:while i tried to make int array[1000][1000][1000] compiler gave error, with array litlle bigger than [510][510][2] compiler halts. why so? if i want to use arrays such big, do i have to use malloc?Maybe because static arrays are created on the stack, your application doesn't have enough stack space? Creating a dynamic array might work. int[][][] X; X.length = 1000; for(int i = 0; i < X.length; i++) { X[i].length = 1000; for(int j = 0; j < X[i].length; j++) X[i][j].length = 1000; } Or maybe you can create one dimensional array and do your own indexing... int[1000*1000*1000] X; Just out of curiosity, and this is not a criticism, but why does one need such large arrays in RAM? -- Derek Melbourne, Australia 11/05/2005 9:15:04 AM
May 10 2005