[IronPython] clr.AddReference effect how GC work ?!?!?!?

Curt Hagenlocher curt at hagenlocher.org
Wed Apr 23 11:39:33 PDT 2008


On Wed, Apr 23, 2008 at 12:23 AM, Sakesun Roykiattisak
<sakesun at boonthavorn.com> wrote:
>
> However, if you uncomment the line "clr.AddReference('System')"
> and rerun it again the system will simple halt, memory usage
> will keep raising.

I've been playing with this a bit while waiting for builds to finish
today, and I found some interesting things:

1. If you try to add a reference to a non-existent assembly, the
problem still happens.  Replace your clr.AddReference with the
following to demonstrate this:

try: clr.AddReference('System89')
except: pass

2. If you add a reference with a strong name, the problem does *not*
happen.  Replace your clr.AddReference with the following to
demonstrate this:

clr.AddReference('System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089')

The primary difference between the two is that the former results in a
call to both Assembly.Load and Assembly.LoadWithPartialName -- each of
which trigger the AssemblyResolve event on the AppDomain -- while the
latter is resolved by Assembly.Load without ever firing
AssemblyResolve.

--
Curt Hagenlocher
curt at hagenlocher.org


More information about the Users mailing list