Bug 19281 – GC mishandles allocations >= 4GB

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2018-10-01T07:17:03Z
Last change time
2018-12-30T02:42:18Z
Assigned to
No Owner
Creator
Rainer Schuetze

Comments

Comment #0 by r.sagitario — 2018-10-01T07:17:03Z
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) [email protected](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.
Comment #1 by github-bugzilla — 2018-12-30T02:42:17Z
Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/d931921a4937c5b926fac9405b6246eddc7efaaa fix issue 19281 - GC mishandles allocations >= 4GB make sure, number of pages is multiplied with PAGESIZE as a size_t, not an uint https://github.com/dlang/druntime/commit/18c8003215321b815aab98fe70dac47fa8391134 Merge pull request #2420 from rainers/issue19281 fix issue 19281 - GC mishandles allocations >= 4GB merged-on-behalf-of: Nicholas Wilson <[email protected]>