[Mono-devel-list] Assembly Unloading

Jim Purbrick jimpurbrick at yahoo.co.uk
Sun May 8 07:55:58 EDT 2005

Hi Zoltan,

Now that Sebastien has helped make the security
situation clearer, I think unloading assemblies is
(hopefully) the last big issue I need to resolve.

I've had a look at mono_assembly_close and it looks
like it might be OK to just call that to get rid of
the assmembly for a script. Referenced assemblies
won't be unloaded, but as scripts should only be
referencing library assemblies, which can stay loaded,
that seams OK.

Looking at the other things that mono_domain_free does
hightlights some issues which might be more
problematic. It seems to go through trashing vtable,
class info, static data and jit output hash tables.
Presumably if I wanted to unload an assembly I'd need
to selectively remove the data relating to the
assembly from these hash tables. Is there a way to
find out which entries relate to the assembly I want
to unload?

In the case of LSL assemblies there is no static data,
which might make things easier, although there will
presumably be class info and jit output. Could I use
the mechanisms used by DynamicMethod to manage the
collection of JIT output? Would that just leave me
class info to clean up? Given that I know which class
I want to get rid of would that be easy enough to

Is this a reasonable approach to take? Is there
anything else I need to think about? Should I just use
separate domains for each of the (1000s) of scripts?
Should I just implement Richard's suggestion of saving
the scripts, destroying the domain and then loading
the ones I need again to clear out the assemblies and
JIT output?

Thanks for all your help,



How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

More information about the Mono-devel-list mailing list