I have just discovered that if generating assemblies via Reflection.Emit, the .NET framework keeps references in a static member that prevents Reflection.Emit classes not to be GC'ed.
I cannot use DynamicMethod due to limitations. I also generate a lot of assemblies (incremental compiler of IronScheme) over the course of a program (could be 1000+).
Hence, I was thinking to just handle the code generation in a separate domain, and unload it later (have not decided how to handle this).
Does anyone have any experience how expensive this would be?