Assemply and using Activator.CreateInstance

  • Thread starter Thread starter Hulk
  • Start date Start date
H

Hulk

Hello All,

If I load an Assembly (.DLL file) from Process (.Exe file)
using Activator.CreateInstance() method are there or should
I remove Assemply (.DLL) from memory after using it with
Activator's method other method?

I would like to know that are there any possibilities that Assembly
will
remain in memory after process (.exe) is exited.

Have anyone of you any ideas about this?

Cheers!
 
Unloading assemblies from an AppDomain is a pain and not (IIRC)
recommended; any specific reason you want to do it? The other thing to
try is loading it in a separate AppDomain that you can trash
afterwards.

Marc
 
Maybe I misread your intent slightly:
after process (.exe) is exited

Well, if the /process/ ends, then everything loaded in that process
ends; it is, however, possible for a process to outlive the Main()
method if you fire up a non-background thread: the process lives as
long as there is a non-background thread alive - very useful for
writing server applications where the Main() method just kicks things
off.

Marc
 
Hi,

Hulk said:
Hello All,

If I load an Assembly (.DLL file) from Process (.Exe file)
using Activator.CreateInstance() method are there or should
I remove Assemply (.DLL) from memory after using it with
Activator's method other method?

IIRC you cannot unload an assembly from memory. You would have to create
another appdomain and then unload it. A PITA if you ask me.
I would like to know that are there any possibilities that Assembly
will
remain in memory after process (.exe) is exited.

Have anyone of you any ideas about this?


It will not, it will be unloaded when your appdomain ends.
 
Back
Top