Skip to content

Instantly share code, notes, and snippets.

@btjake
Created March 21, 2013 02:16
Show Gist options
  • Save btjake/5210212 to your computer and use it in GitHub Desktop.
Save btjake/5210212 to your computer and use it in GitHub Desktop.
they see me trollin...
using System;
using System.Collections;
namespace ObjectSize
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(SizeOfInstantiatedObjects());
Console.Read();
}
static long SizeOfInstantiatedObjects()
{
var l=new ArrayList();var s=GC.GetTotalMemory(true);for(int i=0;i<100000;i++)l.Add(new Object());return GC.GetTotalMemory(true)-s;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment