Assemply and using Activator.CreateInstance

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!
 
M

Marc Gravell

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
 
M

Marc Gravell

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top