【发布时间】:2018-06-15 19:08:51
【问题描述】:
byte[] buffer2 = new byte[4294743227]; // string with System.OverflowException
数字 4294743227 是 uint。
为什么会出现异常?
【问题讨论】:
-
将近 4 GB 的存储空间!
-
我不会使用
uint,尝试使用long。 -
@maccettura,是的。
-
@DanielA.White 实际上,它接近 16 场演出。他试图分配超过 40 亿个 int,每个 int 占用 4 个字节。