大对象堆碎片:CLR有什么解决办法呢? [英] Large Object Heap fragmentation: CLR has any solution to it?

查看:151
本文介绍了大对象堆碎片:CLR有什么解决办法呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你的程序是这样的,它需要做很多的分配/解除分配大型对象(> 85000字节)的,其最终将导致内存碎片和你的应用程序将抛出内存溢出异常。

If you application is such that it has to do lot of allocation/de-allocation of large size objects (>85000 Bytes), its eventually will cause memory fragmentation and you application will throw an Out of memory exception.

有没有解决这个问题,或者是CLR内存管理的限制吗?

Is there any solution to this problem or is it a limitation of CLR memory management?

推荐答案

不幸的是,我见过的唯一的信息表明,管理风险因素自己:再利用大型对象,对其进行分配伊始,确保他们的大小是彼此的倍数,使用替代数据结构(列表,树),而不是阵列。这只是给了创建无碎片列表,而不是一个大的阵列,分裂成更小的的我的另一个想法。列/解释似乎是最常见的罪魁祸首IME

Unfortunately, all the info I've ever seen only suggests managing risk factors yourself: reuse large objects, allocate them at the beginning, make sure they're of sizes that are multiples of each other, use alternative data structures (lists, trees) instead of arrays. That just gave me an another idea of creating a non-fragmenting List that instead of one large array, splits into smaller ones. Arrays / Lists seem to be the most frequent culprits IME.

下面是关于它的MSDN杂志文章: <一href="http://msdn.microsoft.com/en-us/magazine/cc534993.aspx">http://msdn.microsoft.com/en-us/magazine/cc534993.aspx,但没有那么多有用了。

Here's an MSDN magazine article about it: http://msdn.microsoft.com/en-us/magazine/cc534993.aspx, but there isn't that much useful in it.

这篇关于大对象堆碎片:CLR有什么解决办法呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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