www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19745] New: Incredible memory consumption for function with

https://issues.dlang.org/show_bug.cgi?id=19745

          Issue ID: 19745
           Summary: Incredible memory consumption for function with huge
                    body
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

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/nlhybmioaoxkydicmtjj forum.dlang.org.

--
Mar 16 2019