Often repeated array allocations

Namespace rswhite4 at googlemail.com
Sat Jul 20 15:51:24 PDT 2013


On Saturday, 20 July 2013 at 21:39:31 UTC, bearophile wrote:
> Namespace:
>
>> Yeah, but aren't 4000 elements a bit much for a stack 
>> allocated array?
>
> 4000 floats take about 16 KB. If your function is not recursive 
> and it's not much transitively recursive, then I think it's 
> acceptable. But how much stack are your other functions using? 
> You have to estimate if you have enough stack space. Today it's 
> very easy to have 50+ MB of stack, if necessary. DMD on Windows 
> supports a linker command like this:
>
>  -L/STACK:200000000
>
> Bye,
> bearophile

So, you would never allocate with float[]?


More information about the Digitalmars-d-learn mailing list