问题描述
如果您的应用程序必须对大尺寸对象(>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 杂志文章: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有什么解决办法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)