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: nob...@puremagic.com
          Reporter: r.sagita...@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.

--

Reply via email to