Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call C# functions from anywhere using URL (HTTP server)
#10
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:
 
Code:
Copy      Help
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"));
}


Messages In This Thread
RE: Call C# functions from anywhere using URL (HTTP server) - by Gintaras - 01-28-2024, 03:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)