4

What happens when I call Assembly.Load(Byte[]) multiple times with a Byte array containing the same assembly ?

Will I get the same instance of Assembly for each call ?

The same assembly loaded multiple times within the app domain ???

Guillaume
  • 12,824
  • 3
  • 40
  • 48
  • You'll actually get a leak. There was a service app I've designed back in 2006 which was using this approach. We had to restart it every Sunday as it was eating up 4Gb RAM and 8Gb paged 'cause of Assembly.Load(). – Vitaly Jul 29 '11 at 21:10
  • Technically it's not a leak of course. However there's no point to have more than one instance of Assembly loaded into AppDomain - you're most probably using just one and all others are just hanging around eating up server memory. – Vitaly Jul 29 '11 at 21:12

1 Answers1

4

You will get a new Assembly object with each call, read the documentation, there is a note near the end:

"Note that this method overload always creates a new Assembly object with its own mapping."

HasaniH
  • 8,232
  • 6
  • 41
  • 59