This documentation is archived and is not being maintained.

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 ICLRRuntimeHost::Stop Method method can be used to disable the common language runtime in a process. After ICLRRuntimeHost::Stop Method has been called on a process, the runtime cannot be restarted in that process. ICLRRuntimeHost::Stop Method must be called once for each time ICLRRuntimeHost::Start Method has been called.


The ICLRRuntimeHost Interface interface is new in the .NET Framework version 2.0. In versions 1.0 and 1.1, use the ICorRuntimeHost::Stop Method method to disable the runtime.