J
J
Jarwis2015-01-13 13:30:28
.NET
Jarwis, 2015-01-13 13:30:28

What is the performance impact of creating a new AppDomain?

Good day.
I have a task - I need to dynamically load and unload other assemblies from the C # application. As far as I know, once an assembly is loaded, it cannot be unloaded, but the entire AppDomain can be unloaded. Therefore, the question is, how justified (and is it justified at all) to create a new AppDomain for a new loaded assembly? One AppDomain for all assemblies will not work, because code from one assembly can be called and run when another assembly needs to be unloaded. The number of such assemblies can vary from 5 to 10-15.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-01-22
@Jarwis

I think it's justified. this is the only "honest" way to unload the assembly.
When calling a function from another AppDomain, marshalling is used so that there will be performance losses for serialization / deserialization of objects transferred / returned between assemblies. If the transmitted/returned data is not much then it is not critical. Memory costs for additional GCs and the AppDomain themselves, I think, are not fundamental.
An alternative was recently described , but IMHO you should not do this.
Threat If you are interested in a ready-made framework for the application, please contact us.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question