clear array

bearophile bearophileHUGS at lycos.com
Mon Oct 15 19:09:17 PDT 2012


Damian:

> destroy and clear work nicely, except when using large arrays 
> dmd is taking quite a while to compile
>
> int[1000][1000] arr;
> destroy(arr);

Unfortunately currently DMD/druntime is not designed to handle 
large fixed-sized arrays well, in general (large static floating 
point or char 2D arrays are the worst case). In such cases you 
sometimes have to use a dynamic array, or sometimes a little more 
efficiently a fixed sized array of dynamic arrays. In Bugzilla 
there are two ore more bug entries that ask for speeder 
compilations or better handling of such large fixed-sized arrays.

My dmd isn't even running the program that "int[1000][1000] arr;" 
array inside the main, I think I have to increase stack size.

Maybe you have found another case where dmd or its druntime are 
not well optimized, I have filed it in Bugzilla for you:

http://d.puremagic.com/issues/show_bug.cgi?id=8828

See there for more info.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list