RickStrahl/Westwind.Scripting

Recompile .dll for rule engine and effect on memory leak (old .dlls)

mshahins opened this issue · 1 comments

Hi Rick - I have looked at your library; it's quite impressive. I am evaluating it to use in my current project. Basically I want to use to implement rule engine. I am thinking about generating one dynamic .dll per rule. And these .dll would be cahced (along with instance) and it will be executed with data whenever it's required.

Along with this; Basically I want to give users to change rules at run time; that means I have to recompile the rule; unload old dll and load new .dll. While creating new .dll I do use one .dll which is specific to my project. Is there any clean way to load / unload .dll in Westwind.Scripting so I don't have memory leak.

I do use AssemblyLoadContext.Unload but it does not actually unload old assembly. So on recompile code during runtime assemblies are keep increasing (i.e. memory leak).

If user changes rules multiple times I want to keep unload old .dlls. How efficient I can do that ?