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

NoteNote

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

See Also

Reference

AppDomain.Unload Method

Other Resources

Hosting the Common Language Runtime