Using class instance memory in C #

Possible duplicate:
How much memory does the C # /. NET object use?

As in the header, how can I check how much memory an instance of a class occupies in memory in C # (webforms)

+3
source share
2 answers
private System.Diagnostics.PerformanceCounter ramCounter; 
ramCounter = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes"); 

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

These are the tools at your disposal: D hope this helps.

+3
source

Source: https://habr.com/ru/post/1786771/


All Articles