Dela via


Unloading Domains and Shutting Down a Process

Application domains can be unloaded without stopping the entire process. Hosts can take advantage of this feature to unload code that is no longer needed, thereby reducing memory use and increasing the scalability of their application.

The System.AppDomain class includes a static method called Unload that hosts can use to unload a particular application domain. AppDomain.Unload performs a graceful shutdown, not unloading the application domain until there are no more active threads.

Assemblies that have been loaded into the default application domain or assemblies that have been loaded as application domain-neutral cannot be unloaded without shutting down the entire process.

The .NET Framework versions 1.0 and 1.1, use the ICorRuntimeHost::Stop method to disable the runtime.

The .NET Framework version 2.0 uses the ICLRRuntimeHost::Stop method to disable the common language runtime in a process. After the ICLRRuntimeHost::Stop method has been called on a process, the runtime cannot be restarted in that process. ICLRRuntimeHost::Stop must be called once for each time that the ICLRRuntimeHost::Start method has been called.

See Also

Reference

AppDomain.Unload

Other Resources

Hosting Overview