Hi,
Doing a simple stress test to see if the ScriptLibrary release scripts suffer leakage due to repetitive compilation. Doing the test freezes up VS 2013 to the point where you have to kill it using Task Manager. Nothing in the IDE responds to anything after trying to set a breakpoint while the test is running for a while. It seems to get incrementally slower also as the loop runs longer.
```
[TestMethod]
public void TestMethod1()
{
var b = new StringBuilder();
b.AppendLine("using System;");
b.AppendLine("public class Script {");
b.AppendLine(" public int Sum(int a, int b) {");
b.AppendLine(" return a+b;");
b.AppendLine(" }");
b.AppendLine("}");
for (int n = 0; n < 1000000000; n++)
{
dynamic script = CSScript.Evaluator.LoadCode(b.ToString());
int result = script.Sum(10, 20);
}
GC.Collect();
GC.WaitForFullGCComplete(10000);
Console.WriteLine("Done");
}
```
Comments: Hi Oleg, First off - thank you for taking the time (and a fair amount of it) to answer my question in so much detail. It is sincerely appreciated. Just as a smiley face comment :-), I am too well aware of the assembly leakage shortcomings in the framework. About a decade ago I built an enterprise service bus (heavily dependent on XML technologies) for one of the biggest companies in the world. The developers using my framework went and put C# code in the XSL, which I unknowingly recompiled every time the transaction was hit. Imagine debugging a message processing framework that works 99.9999% for 50 distinct message queue agents but has a memory leak in one due to the simplest DateTime.Now.ToString() statement in an XSL :-( :-( Thank you for confirming my findings with your lib however. The question (to myself), is that if I were to cache the IScript and only recompile when necessary, practically - how long will it take before I have to "restart" whatever it is I am doing due to wonkiness. Oleg, I will do further testing. From a usability point of view your scripting interface is without a doubt the cleanest I have seen in my short time of looking at options to make portions of my code "variable". Thanks again, Regards, Gawie
Doing a simple stress test to see if the ScriptLibrary release scripts suffer leakage due to repetitive compilation. Doing the test freezes up VS 2013 to the point where you have to kill it using Task Manager. Nothing in the IDE responds to anything after trying to set a breakpoint while the test is running for a while. It seems to get incrementally slower also as the loop runs longer.
```
[TestMethod]
public void TestMethod1()
{
var b = new StringBuilder();
b.AppendLine("using System;");
b.AppendLine("public class Script {");
b.AppendLine(" public int Sum(int a, int b) {");
b.AppendLine(" return a+b;");
b.AppendLine(" }");
b.AppendLine("}");
for (int n = 0; n < 1000000000; n++)
{
dynamic script = CSScript.Evaluator.LoadCode(b.ToString());
int result = script.Sum(10, 20);
}
GC.Collect();
GC.WaitForFullGCComplete(10000);
Console.WriteLine("Done");
}
```
Comments: Hi Oleg, First off - thank you for taking the time (and a fair amount of it) to answer my question in so much detail. It is sincerely appreciated. Just as a smiley face comment :-), I am too well aware of the assembly leakage shortcomings in the framework. About a decade ago I built an enterprise service bus (heavily dependent on XML technologies) for one of the biggest companies in the world. The developers using my framework went and put C# code in the XSL, which I unknowingly recompiled every time the transaction was hit. Imagine debugging a message processing framework that works 99.9999% for 50 distinct message queue agents but has a memory leak in one due to the simplest DateTime.Now.ToString() statement in an XSL :-( :-( Thank you for confirming my findings with your lib however. The question (to myself), is that if I were to cache the IScript and only recompile when necessary, practically - how long will it take before I have to "restart" whatever it is I am doing due to wonkiness. Oleg, I will do further testing. From a usability point of view your scripting interface is without a doubt the cleanest I have seen in my short time of looking at options to make portions of my code "variable". Thanks again, Regards, Gawie