Bug 8301 – Access violation when a big array is allocated
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-26T07:08:00Z
Last change time
2013-11-28T18:08:27Z
Keywords
pull
Assigned to
nobody
Creator
mp81ss
Comments
Comment #0 by mp81ss — 2012-06-26T07:08:59Z
import std.stdio;
void main()
{
try {
byte[] big_buf = new byte[4294967295];
writeln("Allocated");
}
catch(Exception) {
writeln("never displayed");
}
}
The string "never displayed" is never displayed and the client crushes with object.Error: Access Violation.
Same if instead of (2^32 -1) you put -1.
Comment #1 by timon.gehr — 2012-06-26T08:35:49Z
It is to be expected that catch(Exception) will not catch an Error, because Exception is not a super class of Error.
However, the code snippet should throw OutOfMemoryError. There should not be an access violation.