Large Object Heap fragmentation: CLR has any solution to it?(大对象堆碎片: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 杂志文章: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有什么解决办法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:大对象堆碎片:CLR有什么解决办法吗?
基础教程推荐
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01