I am trying to play with memory profiling (for the first time, so please forgive my ignorance), just to see how much memory is consumed by classes, objects, variables, methods etc. I wrote this sample c# console program called MemPlay.exe:
using System;
using System.Text;
namespace MemPlay 
{
   class Program 
   {
      static void Main(string[] args) 
      {
         SomeClass myObject = new SomeClass();
         StringNineMethod();
      }
      private static void StringNineMethod() 
      {         
         string someString0 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
         string someString1 = string.Empty;
         string someString2 = string.Empty;
         for (int i = 0; i < 9999; i++) {
            someString1 += "9";
            someString2 += someString1;
         }
      }
   }   
   class SomeClass 
   {
   }
}
Once the program ran, I want to find out:
How much memory was consumed by
- MemPlay.exe
- Program class
- SomeClass
- Main method
- myObject
- StringNineMethod
- someString0
- someString1
- someString2
and how much processor was used by:
- MemPlay.exe
- Main method
- StringNineMethod
I tried using VisualStudio's 'Performance Diagnostics' tool, but all I can see is how much memory was used by the whole function (i.e. Main method, StringNineMethod, and the String.Concat method).
Is there any way/tool which can help me see all the details of how much memory each variable, object, class, method consumed? Thanks in advance.
EDIT: No my question is not duplicate of the question suggested, as that question is trying to get object sizes at runtime, I am asking how can I get this information after the program has ended. Just what Visual Studio's Performance Diagnostics tool does, it gives this information after the program has ended execution.
 
     
    

