Open endeffects opened 5 years ago
Can you share more details? Like:
Template.txt
like? What if it's 1GB in size then no surprises!GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced)
?My hunch is that the leak (if any) is coming from the use of Roslyn's C# scripting, which I have heard (from @filipw) is not designed to be used for long-running processes; that is, garbage compiled templates do not get collected. I could be wrong and so it should be confirmed with the Roslyn team/project.
Thanks for the fast reply. Well the Template is a simple Class with some Placeholders, nothing special. There is also no Scripting involved which generates additional Code.
For testing i‘ve used the vs 2017 Monitoring Tools and the Taskmanager.
For now i just wrote this simple Stress Tool to check the Performance.
Btw, i saw a similar behavior in the past by using the Microsoft implementation. I was able to fix this by using a singleton for the Engine and by disposing the AppDomain within the SessionHost.
I also tried this with your Library, but the CompiledTemplate Class throws an IndexOutBounceException by re-using it within the loop. Also i‘m not able to dispose the AppDomain by Design.
When i try to generate code from compiled templates i'm running into a critical memory leak. The following code is for demonstration only.
Btw: All higher level template processing is effected too.