最大阵列可能 [英] largest array possible

查看:47
本文介绍了最大阵列可能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个7维数组[11,11,11,11,11,11,11],它有19.5

百万元素。


当我尝试创建8维数组时,我越界系统

异常。有没有人知道这个限制是由于我的电脑中的内存量是多少?或者是c#语言的限制?


感谢

解决方案

>当我尝试创建8维数组时,我越界系统

异常。有没有人知道这个限制是由于我的电脑中的内存量还是c#语言的限制?




将它写入文件...

-

H.Schampheleer
hu **** @ haps .be
www.haps.be


嗨tony,


我不认为.net有这样的限制。

我会说这是一个记忆问题。


-

Miha Markic - RightHand .NET咨询&软件开发

miha at rthand com


" tony collier" <我***** @ hotmail.com>在消息中写道

news:Xn ************************* @ 194.117.133.134 ..。

我创建了一个7维数组[11,11,11,11,11,11,11],它有19.5百万个元素。

当我尝试创建8维数组我越界系统
异常。有没有人知道这个限制是由于我的电脑中的内存量还是c#语言的限制?

感谢


实际上,我猜有一个限制,因为长度属性限制了

。在1.0版本的框架中,长度

属性是一个32位整数,因此,你被限制为两个元素bbb左右。


使用1.1版本的框架,你有LongLength属性,

暴露64位整数的长度,这意味着你有一个上层

限制为9,223,372,036,854,775,808元素(不用说,很多)。


然而,你遇到的,如Miha所说,可能是因为

的内存约束。对于原始海报,你真的需要在阵列中有很多元素吗?你想做什么?取决于元素的类型,单个内存对于这样的阵列可能在性能方面受到限制。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


Miha Markic < miha at rthand com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...

嗨tony ,

我不认为.net有这样的限制。
我想说这是一个记忆问题。

-
Miha Markic - RightHand .NET咨询&软件开发
miha at rthand com

tony collier <我***** @ hotmail.com>在消息中写道
新闻:Xn ************************* @ 194.117.133.134 ..。

我创建了一个7维数组[11,11,11,11,11,11,11],它有
1950万元素。

当我尝试创建8维数组时我越界系统
异常。有没有人知道这个限制是由于我的电脑中的
内存量还是c#语言的限制?

感谢




i have created a 7-dimensional array [11,11,11,11,11,11,11] which has 19.5
million elements.

when i try to create 8-dimensional array i get out of bounds system
exception. does anyone know if this limitation is due to amount of memory
in my pc or a limiation of c# language?

thanks

解决方案

> when i try to create 8-dimensional array i get out of bounds system

exception. does anyone know if this limitation is due to amount of memory
in my pc or a limiation of c# language?



write it to a file...
--
H.Schampheleer
hu****@haps.be
www.haps.be


Hi tony,

I don''t think that .net has such limitations.
I would say that it is a memory issue.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"tony collier" <me*****@hotmail.com> wrote in message
news:Xn*************************@194.117.133.134.. .

i have created a 7-dimensional array [11,11,11,11,11,11,11] which has 19.5
million elements.

when i try to create 8-dimensional array i get out of bounds system
exception. does anyone know if this limitation is due to amount of memory
in my pc or a limiation of c# language?

thanks



Actually, I would guess there is a limit because of the limitation of
the Length propery. In the 1.0 version of the framework, the Length
property was a 32 bit integer, and because of that, you were limited to two
billion or so elements.

With the 1.1 version of the framework, you have the LongLength property,
which exposes the length in a 64 bit integer, which means you have an upper
limit of 9,223,372,036,854,775,808 elements (needless to say, a lot).

However, what you are running into, like Miha said, is probably because
of a memory constraint. To the original poster, do you really need to have
that many elements in the array? What are you trying to do? Depending on
the type of your elements, the memory alone for such an array could be
restrictive in terms of performance.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Miha Markic" <miha at rthand com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

Hi tony,

I don''t think that .net has such limitations.
I would say that it is a memory issue.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"tony collier" <me*****@hotmail.com> wrote in message
news:Xn*************************@194.117.133.134.. .

i have created a 7-dimensional array [11,11,11,11,11,11,11] which has 19.5 million elements.

when i try to create 8-dimensional array i get out of bounds system
exception. does anyone know if this limitation is due to amount of memory in my pc or a limiation of c# language?

thanks




这篇关于最大阵列可能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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