01-28-2024, 03:18 PM
Is it a single compilation with large code? Or many compilations with normal amount of code?
If many, the most likely reason is - cannot unload temporary memory assemblies. It depends on your C# code.
To see whether assemblies are unloaded:
Install LA 1.0.1 (not 1.0.0).
Debug-run the HTTP server script.
In the debug options menu (the last toolbar button) check "Print module loaded/unloaded".
Run your C# codes many times.
Should print "Module loaded: script" each time, and "Module unloaded: script" sometimes randomly.
If prints only "loaded" but no "unloaded", need to edit your codes. More info:
https://learn.microsoft.com/en-us/dotnet...oadability
Examples:
If many, the most likely reason is - cannot unload temporary memory assemblies. It depends on your C# code.
To see whether assemblies are unloaded:
Install LA 1.0.1 (not 1.0.0).
Debug-run the HTTP server script.
In the debug options menu (the last toolbar button) check "Print module loaded/unloaded".
Run your C# codes many times.
Should print "Module loaded: script" each time, and "Module unloaded: script" sometimes randomly.
If prints only "loaded" but no "unloaded", need to edit your codes. More info:
https://learn.microsoft.com/en-us/dotnet...oadability
Examples:
for (int i = 0; i < 100; i++) {
//this code ic correct. The process never eats more than 60 MB.
string code = """class C { public static int Add(int a, int b=0){return a+b;} }""";
//this code creates a "cannot unload assembly" condition. The process eats ~400 MB after 100 runs.
//string code = """class C { public static int Add(int a, int b=0){ var m = new System.Drawing.Bitmap(1000, 1000); Au.timer2.after(999999, _ => { m.Dispose(); }); return a+b;} }""";
//another example of code that creates a "cannot unload assembly" condition. The process eats ~400 MB after 100 runs.
//string code = """class C { public static int Add(int a, int b=0){ var m = new System.Drawing.Bitmap(1000, 1000); System.Runtime.InteropServices.GCHandle.Alloc(m); return a+b;} }""";
print.it(LaHttp.CallS("Code", $"code={code}", "fun=C.Add", $"a={i}", "b=3"));
}