Why does GC.GetTotalMemory() report huge memory allocations?
- by Seventh Element
I have been playing around with GC.GetTotalMemory(). When I create a local variable of type Titles in the example below, the consumed amount of memory increases by 6276 bytes. What's going on here?
class Program
{
enum Titles { Mr, Ms, Mrs, Dr };
static void Main(string[] args)
{
GetTotalMemory();
Titles t = Titles.Dr;
GetTotalMemory();
}
static void GetTotalMemory()
{
long bytes = GC.GetTotalMemory(true);
Console.WriteLine("{0}", bytes);
}
}