Why does sortedDictionary need so much overhead?
-
12-11-2019 - |
Question
long b = GC.GetTotalMemory(true);
SortedDictionary<int, int> sd = new SortedDictionary<int, int>();
for (int i = 0; i < 10000; i++)
{
sd.Add(i, i+1);
}
long a = GC.GetTotalMemory(true);
Console.WriteLine((a - b));
int reference = sd[10];
output (32 bit):
280108
output (64 bit):
480248
Storing the ints alone (in an array) would require about 80000.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow