什么是DLR的内存占用? [英] What's the memory footprint of the DLR?

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

问题描述

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



我没有访问存储器分析器,虽然和埃里克利珀写道




然后,它开始了DLR [...] DLR的
,则启动
C#编译器的一个特殊版本...




什么是这个内存占用,并且在动态代码是垃圾回收?


解决方案

时,当动态代码是垃圾收集它卸载?




问题的先决条件一个不正确的前提;动态生成代码的不是的当前实现垃圾收集。据缓存,缓存住,直到应用程序域被拆除。我们不知道当的上次的特定代码路径将被调用。



如果你想知道在虚拟的影响内存,堆内存,专用字节,字节共享,等等,那么我的建议是,你使用一个内存分析器来回答这些具体的问题。这里有半打不同的内存占用,你可能会感兴趣的,我不知道哪一个是与你有关的。使用适当的工具来衡量什么有趣的是你,然后你就会知道了。


I'm considering making limited use of C#'s dynamic keyword. My initial time trials were astonishing - a performance hit of less than a second for 100,000 iterations (likely due to DLR caching).

I don't have access to a memory profiler, though, and Eric Lippert wrote:

Then it starts up the DLR [...] The DLR then starts up a special version of the C# compiler...

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

解决方案

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的内存占用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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