ANTS Memory Profiler 10

Navigating to Silverlight source code

If you profile a Silverlight application that runs in a web browser, you can't switch to view your source code using the ANTS Memory Profiler Visual Studio Add-in.

To switch to your source code, configure your Silverlight application to run in out-of-browser mode (MSDN), and profile the Silverlight launcher application (MSDN) instead:

  1. In Visual Studio, open the application's Project Settings and select Enable running application out of browser.
  2. Start ANTS Memory Profiler and click New profiling session
  3. From the list of application types, select .NET executable.
  4. Enter the path to sllauncher.exe - e.g. C:\Program Files (x86)\Microsoft Silverlight\sllauncher.exe
  5. Click Show startup options.
  6. In the Command line arguments field, set the /emulate and /originswitches to the path of the Silverlight application - e.g.

    /emulate:"D:\Dev\SilverlightApplication1\BinRelease\SilverlightApplication1.xap"
     
    /origin:"D:\Dev\SilverlightApplication1\Bin\Release\SilverlightApplication1.xap"
  7.  In the Working directory field, enter the directory containing your Silverlight application.
  8. If you want to record extra performance counters, click Edit counters and select the counters you want.
    Move your mouse pointer over a performance counter to read more about it.
    For more information about performance counters, see Setting up performance counters.
  9. Under Additional profiler options:
    1. Select Profile child processes to include any processes created by your application in profiling. 
      If your application has lots of child processes, this option will slow down your application.
    2. Select Track disposal of IDisposable objects to keep track of when IDisposable objects in your application are disposed.
      This option will slow down your application slightly.
    3. Select Profile unmanaged memory allocations if your application access unmanaged memory through P/Invoke or COM+, and you want to profile the unmanaged memory that your application uses.
      (Not available in Windows XP / Server 2003 and earlier, or when profiling .NET 1.1 applications.)   

      This option will slow down your application by up to fifty percent, because a lot of additional information is being tracked.

  10. Click  Start profiling
    The main profiling window is displayed, and your application will launch. 
    On the timeline, you can see the memory being used by your program, along with any other performance counters you selected.
  11. When your application is in a stable state (ie is fully started up and ready for normal use), click 
    A memory snapshot gives you a detailed breakdown of the memory being used at that point in time, so that you can compare it with later snapshots. 
  12. When you've taken at least two snapshots, you can start to investigate your application's memory usage. See Strategies for memory profiling.
    You will be able to navigate to your source code from profiling results, using the Visual Studio add-in. 

Didn't find what you were looking for?