字节数组的最大大小 [英] Maximum Size of Byte Array

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

问题描述

大家好,


当我在

C#中初始化一个字节数组时,我得到一个OutOfMemoryException:


Byte [] test = new Byte [420000000];


我正在使用ASP.NET 2.0。在ASP.Net 1.1中它工作正常。那么我在做什么

错了?


字节数组的最大长度是多少?


可以来人帮帮我?提前致谢!


-

Gerrit Horeis


软件开发人员

CI-Gate Development& Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de

Hi all,

I''m getting an OutOfMemoryException when I initialize a byte array in
C# like this:

Byte[] test = new Byte[420000000];

I''m using ASP.NET 2.0. In ASP.Net 1.1 it works fine. So what am I doing
wrong?

What is the maximum length of a byte array?

Can somebody help me? Thanks in advance!

--
Gerrit Horeis

Software Developer
CI-Gate Development & Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de

推荐答案

Gerrit< Ge *********** @ web.dewrote:
Gerrit <Ge***********@web.dewrote:

I''m在初始化字节数组时得到OutOfMemoryException

C#像这样:

Byte [] test = new Byte [420000000];


我正在使用ASP.NET 2.0。在ASP.Net 1.1中它工作正常。那么我在做什么

错了?


字节数组的最大长度是多少?


可以来人帮帮我?提前致谢!
I''m getting an OutOfMemoryException when I initialize a byte array in
C# like this:

Byte[] test = new Byte[420000000];

I''m using ASP.NET 2.0. In ASP.Net 1.1 it works fine. So what am I doing
wrong?

What is the maximum length of a byte array?

Can somebody help me? Thanks in advance!



我的猜测是,ASP.NET 2.0在你的应用程序允许使用多少内存方面有一些额外的限制,阻止来自

杀害机器的任性应用程序。如果我可以这样说,那是相当极端的使用

内存...


我不能说我对ASP了解多少。 NET配置 - 也许是ASP.NET组中的某个人

可以帮助你 - 但我的直觉是

这就是问题所在。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet

如果回复该群组,请不要给我发邮件

My guess is that ASP.NET 2.0 has some extra constraints in terms of how
much memory your app is allowed to use, to prevent wayward apps from
killing the machine. If I may say so, that''s a fairly extreme use of
memory...

I can''t say I know much about ASP.NET configuration - perhaps someone
in the ASP.NET group could help you there - but my gut feeling is
that''s where the problem is.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


非常感谢!


这种行为的奇怪之处在于它有时会发生,有时候会发生这种情况。 $ b不行。

但我会在ASP.NET小组中试试运气。


到目前为止,谢谢!


-

Gerrit Horeis


软件开发人员

CI-Gate发展与发展Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de


Jon schrieb:
Thank you very much!

The strange on this behavior is that it sometimes occurs and sometimes
not.
But I''ll try my luck in a ASP.NET group.

Thank you so far!

--
Gerrit Horeis

Software Developer
CI-Gate Development & Consulting GmbH
http://www.ci-gate.de
http://www.xira.de
http://www.bitbauer.de

Jon schrieb:

Gerrit< Ge *********** @ web.dewrote:
Gerrit <Ge***********@web.dewrote:

我在初始化一个字节数组时得到一个OutOfMemoryException

C#就像这样:


Byte [] test = new Byte [420000000] ;


我正在使用ASP.NET 2.0。在ASP.Net 1.1中它工作正常。那么我在做什么

错了?


字节数组的最大长度是多少?


可以来人帮帮我?提前致谢!
I''m getting an OutOfMemoryException when I initialize a byte array in
C# like this:

Byte[] test = new Byte[420000000];

I''m using ASP.NET 2.0. In ASP.Net 1.1 it works fine. So what am I doing
wrong?

What is the maximum length of a byte array?

Can somebody help me? Thanks in advance!



我的猜测是,ASP.NET 2.0在你的应用程序允许使用多少内存方面有一些额外的限制,阻止来自

杀害机器的任性应用程序。如果我可以这样说,那是相当极端的使用

内存...


我不能说我对ASP了解多少。 NET配置 - 也许是ASP.NET组中的某个人

可以帮助你 - 但我的直觉是

这就是问题所在。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet 博客: http://www.msmvps.com/jon.skeet

如果回复该群组,请不要给我发邮件


My guess is that ASP.NET 2.0 has some extra constraints in terms of how
much memory your app is allowed to use, to prevent wayward apps from
killing the machine. If I may say so, that''s a fairly extreme use of
memory...

I can''t say I know much about ASP.NET configuration - perhaps someone
in the ASP.NET group could help you there - but my gut feeling is
that''s where the problem is.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


这种行为的奇怪之处在于它有时会发生,有时候不会发生。

我想它也可能是一些碎片堆/虚拟地址空间。


=获得64位系统;-) {但即使是64位.NET 2.0也有一些32位限制}

http://blogs.msdn.com/tess/archive/2...25/ 496898.aspx

http://msdn.microsoft.com/library/en...nitor_perf.asp

-

Thomas Scheidegger - MVP .NET - ''NETMaster''
http:// www。 cetus-links.org/oo_dotnet.html - http://dnetmaster.net/
The strange on this behavior is that it sometimes occurs and sometimes not.
I guess it could also be some fragmentation of heaps / virtual address space.

=Get a 64-Bit system ;-) {but even 64-Bit .NET 2.0 has some 32-Bit limitations }

http://blogs.msdn.com/tess/archive/2...25/496898.aspx

http://msdn.microsoft.com/library/en...nitor_perf.asp
--
Thomas Scheidegger - MVP .NET - ''NETMaster''
http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/


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

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