.Net does not allow unloading of assemblies. If you want to unload an assembly you have to unload the whole AppDomain.

I’ve created AppDomainManager that handles creating AppDomain, finding a free AppDomain, loading scripts into it, and unloading AppDomains with no active scripts in them.

Its purpose is to create AppDomains and put X number of scripts into each of them. Later when we get microthreading support we will add a feature to move scripts between AppDomains, so if one or more AppDomains has only a few active scripts we can move these to a fresh AppDomain and unload the old one.

With the introduction of AppDomain there came a few changes to the source. Because of how communication between AppDomains (mainly between scripts AppDomain and the main AppDomain) works there has been made some changes.

First of all a new assembly called OpenSim.Region.ScriptEngine.Common.dll has been introduced. It contains interface for scripts and some common code for all AppDomains to execute events inside scripts.

Secondly the LSL BuiltIns (llFunctions) has been moved to a separate file (LSL_BuiltIn_Commands.cs) and are no longer part of the LSL_BaseClass.cs.

Also OpenSim.Region.ScriptEngine.Common.LSL_Types that contains custom Vector and Rotation objects is now used throughout DotNetEngine/Compiler.

Each AppDomain has only 2 references, OpenSim.Region.ScriptEngine.Common.dll and OpenSim.Region.ScriptEngine.DotNetEngine.dll.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Tedds blog

Subscribe now to keep reading and get access to the full archive.

Continue reading