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
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.
You can look at memory usage on a per-process level using performance counters
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