带有二维浮点/双矩阵的内存不足 [英] Out of memory with 2-dimensional float/double matrix

查看:54
本文介绍了带有二维浮点/双矩阵的内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我在我的程序中使用了一个非常大的二维双矩阵(45.000x45.000)

。 />

在矩阵初始化时:


double [,] matrix = new double [45000,45000]我的内存不足< br $>
错误。


该程序在Windows 2003 Server上运行,内存为8 GB Ram $ / b $ b和20 GB虚拟Ram。 />

所以我认为这一定就够了。

如果我确定,双值使用8字节。

所以矩阵必须是45000 * 45000 * 8Byte = 15.087 GB。


这是对吗?

我的第一个问题是现在......必须是一个矩阵C#适合主内存

(8 GB)或矩阵的一方自动复制到虚拟

内存如果矩阵太大了?


换句话说......我可以处理一个占用8 GB以上RAM的矩阵吗?


我也尝试使用float而不是double但我是得到同样的呃ror。


有什么比我可以使用的漂浮物更小吗?

我需要在逗号后面留下4个符号。

我以Windows 2003 Server上的普通用户身份登录。

我可能有一些虚拟资源限制吗?

这是一个标准安装。 />

如果有人知道如何继续追踪我的

问题我会很高兴。

问候,


马丁

Hello,

I?′m using a very large 2-dimensional double matrix (45.000x45.000)
in my program.

At the initialization of the matrix:

double[,] matrix = new double[45000,45000] I am getting an out of memory
error.

The program is running on a Windows 2003 Server with 8 GB Ram
and 20 GB virtual Ram.

So I thought this must be enough.
If I am sure, a double value uses 8 Byte.
So the matrix must be 45000*45000*8Byte = 15.087 GB.

Is this right?

My first question is now... must a matrix in C# fit in the Main Memory
(8 GB) or are party of the matrix automatically copied to the virtual
Memory if the matrix is too large?

In other words... can I handle a matrix which takes more than 8 GB Ram?

I also tried to use float instead of double but I am getting the same error.

Is there something smaller than a float which I could use?
I need 4 signs behind the comma.
I am logged in as normal user at the Windows 2003 Server.
Do I maybe have some virtual resource restrictions?
It is a "standard-installation".

I would be happy if somebody has an idea how to go on bugtracking my
problem.
Regards,

Martin

推荐答案

Martin,


你没有说明是否你的C#应用​​程序是32位还是64位,但如果它是
是32位(这是默认的,可以说是),那么你正在尝试做

32位应用程序中无法实现的东西。


也就是说,每个32位应用程序只能处理2 ^ 32 = 4千兆字节

虚拟地址空间,其中至少有一个千兆字节(1 GB,默认为2 GB / b $ b GB)保留给操作系统ystem。无论你的服务器总共有多少内存,你就不能在一个应用程序中分配超过2或3 GB的内存

。请参阅:

http:/ /msdn2.microsoft.com/en-gb/library/aa366912.aspx

如果您的应用程序是64位应用程序,那么您的内存分配应

成功,因为服务器有足够的可用内存,并且您已指定

您的应用程序为大地址识别。如果你处于32位
世界,那么除了将你的数组分成更小的b / b $ b部分,或者使用例如文件/之外别无选择数据存储数据。


希望这会有所帮助。


-

问候,


Jani J?rvinen先生

C#MVP

芬兰赫尔辛基
ja *** @ removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Martin,

you didn''t state whether your C# application is 32-bit or 64-bit, but if it
is 32-bit (which is the default, one could say), then you are trying to do
something that is not possible in 32-bit applications.

That is, each 32-bit application can only address 2^32 = 4 gigabytes of
virtual address space, of which at least one gigabyte (1 GB, by default 2
GB) is reserved to the operating system. It doesn''t matter how much memory
in total your server has, you can''t allocate more than 2 or 3 GB of memory
in a single application. See here:

http://msdn2.microsoft.com/en-gb/library/aa366912.aspx

If your application is a 64-bit one, then your memory allocation should
succeed given that the server has enough free memory and you''ve specified
your application as being "large address aware". If you are in the 32-bit
world, then there''s no other option than to divide your array into smaller
parts, or use for instance a file/database to store the data.

Hope this helps.

--
Regards,

Mr. Jani J?rvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/


Hello Jani,


非常感谢你的帮助。
Hello Jani,

thank you very much for your help.

你没有说明你的C#应用​​程序是32位还是64位,但如果它是

是32位(这是默认值,可以说是),然后你试图做/ b $ b在32位应用程序中无法实现的东西。
you didn''t state whether your C# application is 32-bit or 64-bit, but if it
is 32-bit (which is the default, one could say), then you are trying to do
something that is not possible in 32-bit applications.



你能告诉我怎么检查吗?


服务器有4xIntel Xeon 3.4 Ghz CPU,操作系统是

带有SP 1.0的Windows 2003企业版


我已经读过Xeon是一个32位CPU,但有版本带有

EM64T扩展。


如何检查我的CPU是否有EM64T扩展?


Win2003企业版怎么样?操作系统。

如何检查它是否是64位版本的Win2003?

问候,

马丁

Can you tell me how to check this?

The server has 4xIntel Xeon 3.4 Ghz CPUs and the Operation System is
Windows 2003 Enterprise with SP 1.0

I?′ve read that Xeon is a 32-Bit CPU but there are versions with the
EM64T Extension.

How can I check if my CPU has a EM64T Extension or not?

And what about the Win2003 Enterprise OS.
How can I check if it is a 64Bit Version of Win2003 or not?
Regards,
Martin


" Jani J?rvinen [MVP]" < ja *** @ removethis.dystopia.fiwrote in message

news:Om ************** @ TK2MSFTNGP06.phx.gbl ...
"Jani J?rvinen [MVP]" <ja***@removethis.dystopia.fiwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...

Martin,



也就是说,每个32位应用程序只能处理2 ^ 32 = 4千兆字节的虚拟地址

空间,其中至少有一千兆字节(1 GB,默认情况下,2 GB)保留给操作

系统。无论你的服务器有多少内存,你都不能在一个应用程序中分配超过2或3 GB的内存。请参阅:

http:/ /msdn2.microsoft.com/en-gb/library/aa366912.aspx

如果您的应用程序是64位应用程序,那么您的内存分配应该会成功

服务器有足够的可用内存,并且您已将应用程序指定为大型

地址识别。如果您处于32位世界,那么除了将
划分为更小的部分,或者使用例如文件/数据库来存储
之外别无选择。
数据。
Martin,

you didn''t state whether your C# application is 32-bit or 64-bit, but if it is 32-bit
(which is the default, one could say), then you are trying to do something that is not
possible in 32-bit applications.

That is, each 32-bit application can only address 2^32 = 4 gigabytes of virtual address
space, of which at least one gigabyte (1 GB, by default 2 GB) is reserved to the operating
system. It doesn''t matter how much memory in total your server has, you can''t allocate
more than 2 or 3 GB of memory in a single application. See here:

http://msdn2.microsoft.com/en-gb/library/aa366912.aspx

If your application is a 64-bit one, then your memory allocation should succeed given that
the server has enough free memory and you''ve specified your application as being "large
address aware". If you are in the 32-bit world, then there''s no other option than to
divide your array into smaller parts, or use for instance a file/database to store the
data.



不,即使64位此应用程序也会失败,对象的最大大小限制为

所有当前版本的CLR均为2GB。当然你可以在64

位上分配8个2GB的阵列,但不是16GB的单个阵列。


Willy。


Nope, even on 64 bit this application will fail, the maximum size of an object is limited to
2GB in all current versions of the CLR. Sure you can allocate 8 array''s of 2GB each on 64
bit, but not a single array of 16GB.

Willy.


这篇关于带有二维浮点/双矩阵的内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆