3

Possible Duplicate:
How much memory does a C#/.NET object use?

Like the title says, how can I check how much memory a class instance takes in memory in c# (webforms)

Community
  • 1
  • 1
Andreas
  • 1,311
  • 5
  • 24
  • 39

2 Answers2

4

You can check this one - Find size of object instance in bytes in c#

Community
  • 1
  • 1
Svetlozar Angelov
  • 21,214
  • 6
  • 62
  • 67
2
private System.Diagnostics.PerformanceCounter ramCounter; 
ramCounter = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes"); 

public string getAvailableRAM()
{
      return ramCounter.NextValue() + "Mb";
}

Those be the tools to your disposal :D hopefully that helps.

Etienne de Martel
  • 34,692
  • 8
  • 91
  • 111
Jake Kalstad
  • 2,045
  • 14
  • 20