> 4. Consequently, an application with objects that wrap unmanaged resources
> should dispose of them before terminating, because termination won't
> immediately release the resources (unlike with unmanaged applications).
Hello, thank you so much for your helpful reply. I have a couple of
follow-on questions.
1. Does each application domain have its own garbage collector, or is there
just one for all app domains in the process (since there is just one heap)?
2. When the garbage collector is triggered by an app. domain terminating,
does it garbage collect the whole heap (including objects from any other app
domains), or just the objects from the terminating app domain?
3. Is the CLR absolutely guaranteed to run any pending finalizers when an
app domain terminates?
> > Hello,
> >
[quoted text clipped - 26 lines]
> destroyed all those objects are destroyed along with it; this implies that
> their finalizers will run and release the unmanaged resources.
Conrad Zhang - 21 Feb 2004 09:24 GMT
1. There is only one garbage collector.
2. You can search MSDN for Garbage collector articles. Basically it collects
everything.
3. Yes and No. Please read
http://weblogs.asp.net/cbrumme/archive/2004/02/20/77460.aspx for more on
finalization.
> Hello, thank you so much for your helpful reply. I have a couple of
> follow-on questions.
[quoted text clipped - 8 lines]
> 3. Is the CLR absolutely guaranteed to run any pending finalizers when an
> app domain terminates?
Dave - 21 Feb 2004 11:32 GMT
The link that Conrad provided has a lot of good information. Brumme is "the"
word on internals. I added a brief note by some of your questions.
> Hello, thank you so much for your helpful reply. I have a couple of
> follow-on questions.
>
> 1. Does each application domain have its own garbage collector, or is there
> just one for all app domains in the process (since there is just one heap)?
Currently one but this may change. There's talk about adding more
finalization threads, more GC, etc. However, from an app's perspective you
should not need to worry about the implementation details.
> 2. When the garbage collector is triggered by an app. domain terminating,
> does it garbage collect the whole heap (including objects from any other app
> domains), or just the objects from the terminating app domain?
It guarantees that at a minimum objects from the doomed appdomain are
collected; more then that is not defined by there's nothing that would
prevent it.
> 3. Is the CLR absolutely guaranteed to run any pending finalizers when an
> app domain terminates?
Yes.