void write(int a) {}
void main()
{
int a;
static foreach (i; 1 .. 400_000)
{
a = i;
write(a);
}
}
On my box with a 64-bit LDC, the process dies due to OOM after some 18 GB. 32-bit DMD dies much sooner obviously. From https://forum.dlang.org/post/[email protected].
Comment #1 by puneet — 2019-03-16T17:50:19Z
Created attachment 1735
Code with a BIG function body
Comment #2 by puneet — 2019-03-16T17:54:28Z
With the static foreach, it seems it is the static foreach unrolling which takes a lot of memory.
On the other hand, if you create physical code with a large function, the compiler does not go OOM, but seems to take forever. On my i7 linux box I kill the compilation process after it failed to produce object file even after 2 hours compiler.
I have attached test.d.xz
Comment #3 by kinke — 2019-03-16T20:39:07Z
Ah, thanks for checking - then we have 2 separate, orthogonal issues here.
Comment #4 by ibuclaw — 2019-03-21T07:51:10Z
This is a duplicate of another bug I think.
Comment #5 by ibuclaw — 2019-03-21T07:55:44Z
(In reply to Puneet Goel from comment #2)
> With the static foreach, it seems it is the static foreach unrolling which
> takes a lot of memory.
>
> On the other hand, if you create physical code with a large function, the
> compiler does not go OOM, but seems to take forever. On my i7 linux box I
> kill the compilation process after it failed to produce object file even
> after 2 hours compiler.
>
> I have attached test.d.xz
What you are describing I think is covered by this bug.
https://issues.dlang.org/show_bug.cgi?id=6401
Comment #6 by dfj1esp02 — 2019-03-21T15:52:17Z
6401 is dmc backend optimizer problem, this example fails in frontend.
Comment #7 by robert.schadek — 2024-12-13T19:02:36Z