www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19281] New: GC mishandles allocations >= 4GB

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

          Issue ID: 19281
           Summary: GC mishandles allocations >= 4GB
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de

Huge allocations are mistreated by the GC, e.g.

import core.memory;
import std.stdio;

void main()
{
        size_t sz = 2L^^32;
        auto ptr = GC.malloc(sz);
        auto info = GC.query(ptr);
        writeln(info);
        assert(info.size >= sz);
}

dmd -m64 -run test.d
BlkInfo_(1F953FE0000, 0, 0) core.exception.AssertError large.d(10): Assertion failure => The returned size is reported as 0. The problem ist that the size of large allocations are stored in a uint-array bPageOffsets, which causes bPageOffsets[p]*PAGESIZE to overflow. --
Oct 01 2018