is the array literal in a loop stack or heap allocated?

Imperatorn johan_forsberg_86 at hotmail.com
Wed Oct 11 05:22:58 UTC 2023


On Wednesday, 11 October 2023 at 02:54:53 UTC, mw wrote:
> Hi,
>
> I want to confirm: in the following loop, is the array literal 
> `a` vs. `b` stack or heap allocated? and how many times?
>
> void main() {
>
> int[2] a;
> int[] b;
>
> int i;
> While(++i <=100) {
>
>   a = [i, i+1];  // array literal
>   b = [i, i+1];
>
> }
>
> }
>
>
> Thanks.

profile=gc


More information about the Digitalmars-d-learn mailing list