内存溢出:有Microsoft.CSharp.RuntimeBinder.Semantics越来越多的 [英] Memory Overflow: Having an increasing number of Microsoft.CSharp.RuntimeBinder.Semantics

查看:1278
本文介绍了内存溢出:有Microsoft.CSharp.RuntimeBinder.Semantics越来越多的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我们正在追捕我们的应用程序的一些内存泄漏,做一些操作(加载和关闭一个项目我们的应用程序中)的时候,我们知道,总是内存增加一点点。

We are currently hunting some memory leaks in our application, when doing some operation(loading and closing one project inside our application), we know that the memory increase always a little bit.

我们已经发现了很多人,但目前,大多数10+高增长类(根据我们的工具,蚂蚁内存分析器8.2):

We have already found a lot of them, but now, the 10+ most increasing classes are (according to our tool, ANTS Memory Profiler 8.2):


  • Microsoft.CSharp.RuntimeBinder.Semantics.SYMTBL +键

  • Microsoft.CSharp.RuntimeBinder.Semantics.LocalVariableSymbol

  • Microsoft.CSharp.RuntimeBinder.Semantics.CONSTVAL

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRCONSTANT

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRCLASS

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRTYPEOF

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRLIST

  • Microsoft.CSharp.RuntimeBinder.Semantics.MethWithInst

  • Microsoft.CSharp.RuntimeBinder.Semantics.CMemberLookupResults

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRMEMGRP

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRCALL

  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRWRAP

  • Microsoft.CSharp.RuntimeBinder.Semantics.AggregateDeclaration

  • Microsoft.CSharp.RuntimeBinder.Semantics.Scope

  • Microsoft.CSharp.RuntimeBinder.Semantics.SYMTBL+Key
  • Microsoft.CSharp.RuntimeBinder.Semantics.LocalVariableSymbol
  • Microsoft.CSharp.RuntimeBinder.Semantics.CONSTVAL
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRCONSTANT
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRCLASS
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRTYPEOF
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRLIST
  • Microsoft.CSharp.RuntimeBinder.Semantics.MethWithInst
  • Microsoft.CSharp.RuntimeBinder.Semantics.CMemberLookupResults
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRMEMGRP
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRCALL
  • Microsoft.CSharp.RuntimeBinder.Semantics.EXPRWRAP
  • Microsoft.CSharp.RuntimeBinder.Semantics.AggregateDeclaration
  • Microsoft.CSharp.RuntimeBinder.Semantics.Scope

不幸的是,我不知道这是什么,所以这是一个有点难受,找什么,我如何/应该释放。

Unfortunately, I don't what this is, so It's a little bit hard for me to find how/what I should release.

我查了实例树,但,它会全部用微软的东西的方式。

I checked the instance tree but, it goes all the way with microsoft stuff.

的问题是,当我们做了开/关的项目中,我们经历了很多去(大部分)我们的代码。

The issue is that when we do the "Open/close" of a project, we go through a lot(most of) our code.

修改我们的应用程序的一个部分使用动态关键字为某些资源,可以被链接。这里的类不是一次性的,我应该做一些特别的东西与他们?

EDIT One part of our application uses the dynamic keyword for some resources, it may be linked. The class here are not Disposable, should I do something special with them?

编辑2

我敢肯定,这是关系到我的动态的东西,似乎C#中使用时,动态创建缓存。但目前我不知道为什么它的增长(我加载相同的类的时候,我将有完全相同的签名所有的时间),也不是如何清除这一点。

I'm pretty sure this is related to my dynamic stuff, it seems that C# create a cache when using dynamic. But currently I've no idea why it grows(I load the same classes all the time, and I will have exactly the same signature all the time), nor how to clear this.

推荐答案

动态关键字应该在大多数的解决方法可以发现不要求它的情况很少,因为所用。

Dynamic keyword should be used seldom since in most of the cases workarounds can be found not requiring it.

根据您的应用程序,最好的建议是仔细一想,如果让你避免动态你可以设计你的解决方案。
下面是一些有效的使用案例动态: https://开头MSDN。 microsoft.com/en-us/library/dd264736.aspx

Based on your application, the best advise is to carefully think if you can design your solution so that you avoid dynamic. Here are some valid use cases for dynamic: https://msdn.microsoft.com/en-us/library/dd264736.aspx

既然你确实需要使用动态的,我会建议监测你的代码,并找出哪些部分是最消耗内存。
的确使用动态增加基于它需要执行各类的查找的,但有记忆外的一个例外,你需要使用大量的动态变量对于很多未知类型。

Given that you really need to use dynamic, I would suggest instrumenting your code and figure out what parts are the most memory consuming. Indeed using dynamic increases your memory consumption based on the fact that it needs to perform all kinds of lookups, but to have a out-of-memory exception you would need to use a lot of dynamic variables for a lot of unknown types.

有许多不同的 的方式调用未知类型的方法,并测量和调整的瓶颈是要走的路。

There are a lot of different ways for calling methods on unknown types, and measuring and tuning the bottlenecks is the way to go.

PS:另外,在发布某些代码段有很大帮助。

PS: Also, posting some code snippets helps a lot.

这篇关于内存溢出:有Microsoft.CSharp.RuntimeBinder.Semantics越来越多的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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