Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using VS2010 Profiler for memory measurement

I'm looking for using Built-in Visual Studio 2010 Profiler for measure memory usage of my C# functions in a Windows application program, but I could not know how.

I searched the net about how to use VS2010 Profiler, but all links suggest using Silverlight which is related to Web application not Windows Application

Please if any one can tell me how to use VS2010 Profiler in C# Windows application, or send me a link or tutorials or any hint if something is missing, and thanks alot

like image 874
Duaa Avatar asked Jan 19 '11 23:01

Duaa


People also ask

How do you analyze memory usage?

To open up Resource Monitor, press Windows Key + R and type resmon into the search box. Resource Monitor will tell you exactly how much RAM is being used, what is using it, and allow you to sort the list of apps using it by several different categories.

Can Visual Studio detect memory leak?

The Visual Studio debugger and C Run-time Library (CRT) can help you detect and identify memory leaks.


1 Answers

(Full disclosure: I'm on the team that works on this feature.)

The VS2010 Profiler is only available in the Premium and Ultimate editions. There are a number of resources for doing managed memory profiling. Some are older, but still relevant:

  • Blog: The Object Allocation and Object Lifetime views
  • Blog: What code path is allocating the most bytes for a type?
  • Blog: Using VSTS 2008 memory allocation profiling
  • MSDN: Collecting .NET Memory Allocation and Lifetime Data

Object allocation profiling will show you where objects were allocated as well as aggregate statistics (size and count) for each type allocated. Object lifetime shows you when objects were collected (Gen 0, 1, 2) as well as whether or not the object was in the Large Object Heap.

like image 152
Chris Schmich Avatar answered Oct 19 '22 11:10

Chris Schmich