内存超出范围异常 [英] Memory out of range exception

查看:164
本文介绍了内存超出范围异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,我使用非常大的点列表,即

Hi ,
In my application i am using very big lists of points i.e.

List<point> Lst=new List<point>(1008000);



我创建了25个这样的大名单。但遗憾的是CLR抛出了内存异常。

请让我知道如何处理这个问题。

代码块添加 - OriginalGriff [/ edit]



我尝试了什么:



我已经用Google搜索并发现编译为x64解决了这个问题,但我不想将应用程序更改为x64。有没有其他方法来处理内存超出范围问题。


I am creating 25 such big lists. But unfortunately CLR throws out of memory exception.
Please let me know how i can handle this issue.
[edit]Code block added - OriginalGriff[/edit]

What I have tried:

I already googled and found that compiling as x64 solves the issue, but i do not want to change application to x64. Is there any other way to handle memory out of range issue.

推荐答案

在x86机器(32位)上,内存总共限制为4gb,其中操作系统占用1GB理论上3gb用于应用程序,但实际上你只限于1.8gb-2.5gb,具体取决于你的硬件。



如果要强烈重新考虑在内存中保留大量数据,除非那里这是一个很好的理由,阻塞/分块数据在大多数情况下效率更高,你不会受到硬件限制。



看看Key / Value数据存储,甚至是为处理数据而设计的关系数据库。
On x86 machines (32bit) the memory is limited to 4gb total of which the OS takes 1gb which leaves theoretically 3gb for apps but practically you are limited to 1.8gb-2.5gb depending on your hardware.

If should strongly rethink keeping a lot of data in memory unless there is a very good reason for it, blocking/chunking data is much more efficient in most cases and you will not be limited by your hardware.

Look at Key/Value data stores, or even relational databases which were designed for handling data.


这篇关于内存超出范围异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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