static void Main(string[] args)
{
long before = GC.GetTotalMemory(false);
Console.WriteLine("Before: {0:N0}", before);
int data = 100;
string name = "Dotnet Funda";
long after = GC.GetTotalMemory(false);
Console.WriteLine("After: {0:N0}", after);
Console.WriteLine("Approximate Allocations: {0:N0}", after - before);
Console.Read();
}
Result
Before: 11,01,624
After: 11,40,592
Approximate Allocations: 38,968