Summary: Compile-time global dynamic immutable arrays should
                    NOT be constant-folded.
           Product: D
           Version: 2.033
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: critical
          Priority: P2
         Component: DMD

--- Comment #0 from David Simcha <> 2009-10-06 15:04:05 PDT ---
The following program runs out of memory b/c foo is apparently allocated and
created every time through the loop:

import std.math, core.memory, std.stdio;

immutable real[] foo = [0,1,2,3,4];

void main() {

    foreach(i; 0..1_000_000_000) {
        auto bar = poly(i, foo);

Changing the immutable to an enum results in the program still running out of

Removing all references to immutability fixes the problem.  

Changing the array to a static array fixes the problem.

Initializing the array inside main() fixes the problem.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to