Server Memory Leak C#

There seems to be a issue with memory leaking on server resources written in C#. I have created a very simple test script to run on my server code down below

using CitizenFX.Core;

namespace MemLeakServer
{
    public class Test:BaseScript
    {
        public Test() { }
    }
}

Starting up the resource consumes ~2MiB of memory as expected but increase over time by a rate of 0.01MiB every 4 seconds.

After running this basic resource for over an hour memory increased to 9.45MiB

No, this is not a memory leak. This is called C# runtime :stuck_out_tongue: specifically the AppDomain. I personally cannot go into more details about it (literally technically inept), but this is why. Just like V8, there are things running in the background while such a script is running for the runtime itself. That’s what you’re seeing.

It doesn’t leak and it’s not making everything slow. You will see that the memory does not go higher than I think it was around 20MB if the script actually does something. It GC’s around there, and that’s fine.

1 Like

Yeah I see that now the CG run after 1.5 hours bringing back to the original usage. should of waited before posting about it.