Home »

What is an application domain?

Question ListWhat is an application domain?
jamessmith05 author asked 8 years ago
1 Answers
milleranthony7 author answered 8 years ago

An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a Win32 process. The primary purpose of the AppDomain is to isolate applications from each other, and so it is particularly useful in hosting scenarios such as ASP.NET. An AppDomain can be destroyed by the host without affecting other AppDomains in the process.
Win32 processes provide isolation by having distinct memory address spaces. This is effective, but expensive. The .NET runtime enforces AppDomain isolation by keeping control over the use of memory – all memory in the AppDomain is managed by the .NET runtime, so the runtime can ensure that AppDomains do not access each other’s memory.

One non-obvious use of AppDomains is for unloading types. Currently the only way to unload a .NET type is to destroy the AppDomain it is loaded into. This is particularly useful if you create and destroy types on-the-fly viareflection.

Please login or Register to Submit Answer