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
To bring up the window again, click Debug > Windows > Show Diagnostic Tools. Choose Memory Usage with the Select Tools setting on the toolbar. Click Debug / Start Debugging (or Start on the toolbar, or F5). When the app finishes loading, the Summary view of the Diagnostics Tools appears.
Examine managed memory usage. Before you start collecting diagnostics data to help us root cause this scenario, you need to make sure you're actually seeing a memory leak (memory growth). You can use the dotnet-counters tool to confirm that. You can see that the managed heap memory is 4 MB right after startup.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With