.NET进程的内存使用量= 5×CLR堆内存? [英] .NET process memory usage = 5x CLR Heap Memory?

查看:218
本文介绍了.NET进程的内存使用量= 5×CLR堆内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解决了一些内存使用的问题。总的来说我的应用程序收集一些数据值和使用C1 WPF图表和数据网格终于把一切转换成PDF报告,其中可视化

I'm trying to tackle down some memory usage issues. Overall my application collects a few data values and visualizes them using a C1 WPF charts and datagrids finally putting everything into PDF reports.

我的剖析过程中使用YourKit,我面对的情况,该CLR堆大小为120MB〜(这是所有罚款),而进程的内存大小为580MB〜。这是我的实际CLR堆大小的内存消耗的近5倍。我的CLR峰值大小为220MB与710MB进程的内存分配。

Profiling my process using YourKit I'm faced with the situation, that the CLR heap size is ~120MB (which is all fine) while the process memory size is ~580MB. This is nearly 5 times the memory consumption of my actual CLR heap size. My CLR peak size was 220MB vs. 710MB process memory allocation.

我很清楚地知道,没有我的对象堆需要一些开销,栈等。在Java的JVM我已经习惯了典型的因素是围绕〜1.5倍。

I'm well aware that there is some overhead required on my object heap, stacks and so on. In Java JVMs the typical factor I'm used to was around ~1.5x.

这怎么可能过多的内存开销来解释?难道PROCESSS只是自由分配空闲堆空间?如果是,这是否说明710MB与220MB?

How can this excessive memory overhead be explained? Is the processs just allocating free spare heap space? If yes, does this explain the 710MB vs. 220MB?

推荐答案

一对夫妇在这里的其他注意事项。虽然我不exaclty知道你所说的CLR堆大小的意思。 还有的CLR使用约8个不同的堆 - 所以你的内存在堆大小与虚拟内存大小占的部分的区别的看到:

A couple of additional notes here. Though I'm not exaclty sure what you mean by "CLR Heap Size". There about 8 different heaps that the CLR uses - so the memory you see in the Heap Size vs. VM size accounts for some of the difference:

  1. 装载机堆:包含CLR结构和类型系统
  2. 高频堆:静,MethodTables,FieldDescs,接口映射
  3. 在低频堆:EEClass,类加载器和查找表
  4. 存根堆:存根中科院,COM包装,P / Invoke的
  5. 在大对象堆:需要超过85K字节的内存分配
  6. 在GC堆:用户分配的堆内存专用的应用程序
  7. 在JIT code堆:由mscoreee(执行引擎)分配的内存和JIT编译器管理code
  8. 工艺/基堆:互操作性/​​非托管的分配,本机内存,等等

这可能会导致过多的内存使用情况的另外两个项目是内存碎片(多发生于LOH或大对象堆)或高数量的线程。

Two other items which can cause excessive memory usage are memory fragmentation (mostly occurs on the LOH or large object heap) or a high number of Threads.

有很多原因的内存碎片,并排除这一点,最好的办法就是使用WinDbg来分析段大小在GC堆每段。

There are many causes for memory fragmentation and the best way to rule this out is to use WinDbg to analyze the segment sizes for each segment on the GC Heap.

至于大量的线程,你有分配给您的应用程序使用的每个线程的堆栈空间1MB。该存储器被放置在工艺/基堆。因此,如果你有100个线程,你将有内存使用额外的100MB。

As far as a high number of threads, you have 1MB of stack space allocated for each thread that your app uses. This memory is placed in the Process/Base Heap. Therefore if you have 100 threads, you will have an additional 100MB of memory usage.

心连心

这篇关于.NET进程的内存使用量= 5×CLR堆内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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