Memory usage for a 2 millions dummy rows DataTable using .NET Core 2.0 is 694 MB but using .NET Framework it is 405 MB
Why this discrepancy ?
This is the same sample code used in a console application for both platforms:
DataTable dt = new DataTable();
dt.Columns.Add("a");
dt.Columns.Add("b");
dt.Columns.Add("c");
var watch = Stopwatch.StartNew();
for (int i = 0; i < 2000000; i++)
{
var row = dt.NewRow();
row["a"] = i;
row["b"] = i;
row["c"] = i;
dt.Rows.Add(row);
}
watch.Stop();
Console.WriteLine("Time:" + watch.ElapsedMilliseconds.ToString());
Console.WriteLine("Memory (MB):" + GC.GetTotalMemory(false) / 1048576);
Console.WriteLine("Working set (MB):" + Process.GetCurrentProcess().WorkingSet64 / 1048576);