An AppDomain (application domain), is an isolated environment where applications execute.
They help provide isolation,
unloading, and security boundaries for
executing managed code.
Use application domains to isolate tasks that might bring down a process.
If the state of the AppDomain that's
executing a task becomes unstable, the
AppDomain can be unloaded without
affecting the process. This is
important when a process must run for
long periods without restarting. You
can also use application domains to
isolate tasks that should not share
data.
If an assembly is loaded into the default application domain, it cannot
be unloaded from memory while the
process is running. However, if you
open a second application domain to
load and execute the assembly, the
assembly is unloaded when that
application domain is unloaded. Use
this technique to minimize the working
set of long-running processes that
occasionally use large DLLs.
Multiple application domains can run
in a single process; however, there is
not a one-to-one correlation between
application domains and threads.
Several threads can belong to a single
application domain, and while a given
thread is not confined to a single
application domain, at any given time,
a thread executes in a single
application domain.
SO Questions that might be of interest:
I won't profess to be an expert in the area of AppDomains, but I am fairly sure that a COM object leaking memory (i.e. unmanaged memory) will not be freed by unloading the AppDomain. Perhaps someone more familiar with this could comment.
As Brian pointed out, "... in the .NET Framework version 2.0 domain is not guaranteed to unload, because it might not be possible to terminate executing threads. "