相关疑难解决方法(0)

字节[]的最大长度?

我正在尝试创建一个byte长度为s 的数组UInt32.MaxValue.这个数组本质上是一个小的(ish)内存数据库:

byte[] countryCodes = new byte[UInt32.MaxValue];
Run Code Online (Sandbox Code Playgroud)

但是,在我的机器上,在运行时,我得到一个System.OverflowException"算术运算导致溢出".

这是怎么回事?我需要使用unsafemalloc吗?我怎么会在C#中做到这一点?

c# arrays byte unsafe

20
推荐指数
2
解决办法
4万
查看次数

是否存在可以存储在List中的元素的限制?

是否存在可以存储在List中的元素的限制?或者你可以保持添加元素直到你内存不足?

.net c# collections ilist

7
推荐指数
1
解决办法
1031
查看次数

64位VB.NET分配> 2GB的RAM(.NET错误?)

我有一个64位的VB.NET应用程序,并希望分配一个> 2GB的缓冲区.

在下面的代码中,"new"和"ReDim"都抛出"OverflowException".

当这些函数只接受带符号的32位值时,如何分配> 2GB的缓冲区?

(这可能在C#中?)

编辑 - 我正在运行带有4GB RAM的WinXP 64.

Dim width As Long = 19005
Dim height As Long = 32768

Dim buffer() As Byte = New Byte((width * height * 4) - 1) {}

Dim size As Long = (width * height * 4) - 1
ReDim buffer(size)

.net c# vb.net memory 64-bit

5
推荐指数
1
解决办法
3214
查看次数

标签 统计

c# ×3

.net ×2

64-bit ×1

arrays ×1

byte ×1

collections ×1

ilist ×1

memory ×1

unsafe ×1

vb.net ×1