When I use a ZedGraph control in NUnit/MSTest test method the memory usage is much larger (over 8GB for control instance) than in WinForms application.
I use Windows 10 Pro, Rider 2021.1.3, C# 7.1, .NET Framework 4.6, AMD Ryzen 7
When use with WinForms, the main process uses 10 MB of RAM:
public partial class Form1 : Form
{
public Form1()
{
var before= System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;
Console.WriteLine("before: " + before/1024/1024); // gives: 13.2
var zg1 = new ZedGraph.ZedGraphControl();
var after = System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;
Console.WriteLine("after: " + after/1024/1024); // gives: 17.5
}
}
When use in tests, the ReSharperTestRunner64 process uses 8197,4 MB of RAM:
public class TestMemory
{
[Test]
public void testMemory()
{
var before = System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;
Console.WriteLine("before: " + before/1024/1024); //gives: 120.6
var zg1 = new ZedGraph.ZedGraphControl();
var after = System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;
Console.WriteLine("after: " + after/1024/1024); //gives: 8333.5
}
}
I dont understand the difference and cant reproduce the problem on the PC with Intel CPU.