如何确定我的.NET应用程序中的内存使用情况 [英] How to determine memory usage in my .NET application

查看:48
本文介绍了如何确定我的.NET应用程序中的内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,某些用户可以在其中上传他的dll.我需要从该dll创建实例并调用特定方法.而且,我需要在1个进程中使用多个dll来执行此操作,因此我不能选择使用System.Diagnostics.Process.

I have a website where some user can upload his dll. I need to create an instance from this dll and call a specific method. Moreover, I need to do it with several dll's in 1 process, so it is not an option for me to use System.Diagnostics.Process.

是否有一种方法可以确定此方法调用在我的应用程序运行时使用了多少内存或限制了它?预先感谢您的帮助

Is there a way to determine how much memory does this method call use or limit it in my application runtime? Thanks in advance for any help

推荐答案

.Net中的内存使用情况很难衡量-这取决于很多因素,例如是否运行垃圾回收,已加载多少框架等

Memory usage in .Net is very difficult to gauge - It will depend on a lot of factors like whether garbage collection run, how much of the framework has been loaded, etc.

您可以使用假设您已经考虑了在半信任环境中运行用户代码的安全隐患,则需要使用

Assuming for a moment you've already considered the security implications of running a users code in a semi-trusted environment, you need to use an AppDomain to load the DLL - That way it can be unloaded without restarting the whole website / worker pool

这篇关于如何确定我的.NET应用程序中的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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