64位VB.NET清分> 2GB内存(.NET错误?)内存、错误、VB、NET

2023-09-03 03:58:33 作者:心已冰封爱已荒废i

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

在以下code这两个新和REDIM抛出发生OverflowException。

我如何分配缓冲区> 2GB时,这些功能只接受签署32位值?

(这是可能在C#中?)

修改 - 我运行WinXP 64 4GB内存

昏暗的宽度只要= 19005
昏暗的高度只要= 32768

昏暗的缓冲液()作为字节=新字节((宽*高* 4) -  1){}

昏暗的大小,只要=(宽*高* 4) -  1
REDIM缓冲液(大小)

解决方案

显然,这是不可能的,即使在运行64位操作系统的64位.NET应用程序分配超过2GB。

我觉得这是非常令人失望,完全没有考虑什么64位应用程序和操作系统是为进行。我处理的巨大的图像,并希望能够在一次与原始字节的工作都在RAM中。现在,我要实现分页算法来限制块到2GB。

嘿微软,怎么样了abouts你解决这个问题,在未来的.NET版本?是的,我说的修复。的那是因为它是坏了。你怎么能指望64位应用程序起飞,当你的笨的这样的事情。 (你可以告诉大家,我的恼的。)谢谢收听。

VB NET

链接

http://blogs.msdn.com/joshwil/存档/ 2005/08/10 / 450202.aspx

I have a 64 bit VB.NET application and want to allocate a buffer > 2GB in size.

In the following code both the "new" and the "ReDim" throw an "OverflowException."

How can I allocate buffers > 2GB when these functions only accept signed 32 bit values?

(Is this possible in C#?)

Edit - I am running WinXP 64 with 4GB of RAM.

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)

解决方案

Apparently it is not possible to allocate more than 2GB even under 64 bit .net application running on a 64 bit OS.

I find this to be very disappointing and completely without regard for what 64 bit applications and OSs are made for. I am dealing with gigantic images and would like to be able to work with the raw bytes all in RAM at once. Now I have to implement paging algorithms to limit the chunks to 2GB.

Hey Microsoft, hows abouts you fix this in the coming .NET release? Yes, I said fix. That's because it's broken. How do you expect 64 bit applications to take off when you do stupid things like this. (Can you tell that I am annoyed.) Thanks for listening.

Link

http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx