AppDomain.Unload

  • Thread starter Thread starter John Wood
  • Start date Start date
J

John Wood

Does anyone know if an AppDomain.Unload is guaranteed to free all memory
/resources associated with the AppDomain before the method call returns?
 
IIRC AppDomain.Unload triggers a GC - of course the non-memory resources will have to wait for finalization

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

Does anyone know if an AppDomain.Unload is guaranteed to free all memory
/resources associated with the AppDomain before the method call returns?
 
Well, one thing I'm interested in is remoting.
If my second AppDomain has some wellknown objects registered... will
unloading unregister those immediately? My tests show me that's the case...
but I wanted to know if that was guaranteed or just a fluke.

Thanks for your response.

Richard Blewett said:
IIRC AppDomain.Unload triggers a GC - of course the non-memory resources
will have to wait for finalization
 
Hi,

Well it ends all the thread, meaning that all the variables go out of
context and therefore they should be GCed , Ithink it's safe to assume that
all memory/resources are freed.

Cheers,
 
All objects that are rooted in the appdomain to be unloaded will be
reclaimed. The GC will continue to perform garbage collections until all
those objects have been reclaimed - this may take several GC cycles so that
objects with finalizers will have all run to completion.

In addition to objects, all threads with stack in the appdomain will be
unwound to the boundary of the appdomain.

Chris Brumme has written several blogs on this and related issues - he is a
definitive source.

http://blogs.msdn.com/cbrumme
 
Back
Top