本文介绍了什么是DLR的内存占用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在考虑让有限的使用C#的动态关键字。我是惊人的 - 不到一秒钟的性能损失为100000迭代(可能是由于DLR缓存)



我没有访问存储器分析器,虽然和:



What's the memory footprint of this, and is it unloaded when the dynamic code is garbage-collected?

解决方案

The question presupposes an incorrect premise; the dynamically generated code isn't garbage collected in the current implementation. It is cached and the caches live until the appdomain is torn down. We don't know when the last time a particular code path is going to be called.

If you want to know the impact on virtual memory, heap memory, private bytes, shared bytes, and so on, then my suggestion is that you use a memory profiler to answer those specific questions. There are a half a dozen different "memory footprints" you could be interested in, and I don't know which one is relevant to you. Use the appropriate tool to measure whatever is interesting to you, and then you'll know.

这篇关于什么是DLR的内存占用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:23