locked
How to know the data size of my List<T> RRS feed

  • Question

  • see the code

    public class Employee
    {
    	public int ID { get; set; }
    	public string Name { get; set; }
    	public double Salary { get; set; }
    }
    
    List<Employee> oList = new List<Employee>
    {
    	new Employee{ID=1,Name="John",Salary=2000},
    	new Employee{ID=2,Name="Alice",Salary=3000},
    	new Employee{ID=3,Name="keith",Salary=4000},
    	new Employee{ID=4,Name="Sam",Salary=5000},
    };

    how could i know programmatically the size of oList or how much oList will consume memory at run time ?

    please give me sample code to measure size and memory will be taking by oList. thanks


    Wednesday, February 22, 2017 9:25 AM

Answers

  • In Visual Studio, Click Analyze and then click Performance Profiler. Alternatively you can also press ALT+F2.

    This will open the Analysis Target window. In here change the Change Target to Executable. Next check Performance Wizard and click Start.

    In the wizard that show up, select  .NET Memory Allocation and click Next. Select the project and then select An executable (.EXE file). Click Next.

    In the next step, select the full path of the .exe which is produced by building your application. Click Next and then Finish.


    www.midnightprogramer.net

    • Marked as answer by Sudip_inn Wednesday, February 22, 2017 7:09 PM
    Wednesday, February 22, 2017 9:42 AM

All replies

  • In Visual Studio, Click Analyze and then click Performance Profiler. Alternatively you can also press ALT+F2.

    This will open the Analysis Target window. In here change the Change Target to Executable. Next check Performance Wizard and click Start.

    In the wizard that show up, select  .NET Memory Allocation and click Next. Select the project and then select An executable (.EXE file). Click Next.

    In the next step, select the full path of the .exe which is produced by building your application. Click Next and then Finish.


    www.midnightprogramer.net

    • Marked as answer by Sudip_inn Wednesday, February 22, 2017 7:09 PM
    Wednesday, February 22, 2017 9:42 AM
  • there is no option menu called Performance Profiler in Analyze menu. please check and tell me right menu option name or put a screen shot. thanks
    Wednesday, February 22, 2017 11:02 AM
  • can we measure data size or memory consumption of oList programmatically ?
    Wednesday, February 22, 2017 11:15 AM
  • Which Visual Studio 2013 you are using? Premium, Professional, Enterprise? I have shared the link to do that in one of your other questions you asked. Did you tried that?

    www.midnightprogramer.net

    Wednesday, February 22, 2017 2:25 PM
  • i am using VS2013 community Ed. paste your screen shot please.
    Wednesday, February 22, 2017 7:10 PM