[Issue 19281] New: GC mishandles allocations >= 4GB

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 1 07:17:03 UTC 2018


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 at puremagic.com
          Reporter: r.sagitario at 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 at 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.

--


More information about the Digitalmars-d-bugs mailing list