I noticed that the primitive types in C# are really just implemented as aliases to structs defined in the System namespace, e.g. ulong is an alias to the System.UInt64, which is of struct type. Is there any additional space-time overhead to the primitive types in C# arising from this? Say, does ulong really consume only 8 bytes of memory?
In spirit, this should test the memory overhead:
using System;
class Program
{
    static void Main()
    {
        long beforeAlloc = GC.GetTotalMemory(false);
        ulong[] myArray = new ulong[System.Int32.MaxValue];
        myArray[0] = 1;
        long afterAlloc = GC.GetTotalMemory(false);
        Console.WriteLine(((afterAlloc - beforeAlloc) / System.Int32.MaxValue).ToString());
     }
}
But the documentation specifies that GC.GetTotalMemory() method only retrieves the number of bytes currently thought to be allocated, so is there no easy way of finding out without a more sophisticated memory profiler?
 
     
     
    