www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19947] New: OutOfMemoryError with GC-allocs

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

          Issue ID: 19947
           Summary: OutOfMemoryError with GC-allocs
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: black80 bk.ru

program bellow crashed

// dmd -m32 -release -O gctest.d
import std, core.memory;
void main() {
    long r = 0; // using results = dont drop code
    for(int i = 0; i < 1000; i++) {
        auto x = new int[10000000];
        r += x.sum();
    }
    write( r );
}

C:\content\downloadz\dlang>gctest.exe
core.exception.OutOfMemoryError src\core\exception.d(702): Memory allocation
failed
----------------

with -m64 no crashes but prog has more memory than 2GB. 
it cannot be false positive coz array contains all 0s (int.init)
imo something wrong with gc-roots or gc-marks.
code by LDC works fine.

--
Jun 07 2019