JustTrace makes profiling your application easy. Just follow these four steps and you will soon be on your way to identifying and removing memory leaks and performance issues. Keep in mind, profiling is best done regularly so you can detect unusual behavior early and avoid problems before they manifest. Follow these four steps to profile your applications with JustTrace: Assess, Acquire, Analyze, and Act.
Determine what kind of issue you have. Is your application’s memory continuously growing while running? You have a memory leak. Do some parts of your application take too long to run? You have a performance issue.
Identifying your issue will help you take the correct approach when profiling your application with JustTrace, and it will guide you in looking for the cause of the problem.
Now that an assessment has been made, the next step is to acquire data to find potential issues or confirm the application runs as expected.
First, you are going to need a tool. If you have not already downloaded JustTrace, I suggest you do so now. You can try JustTrace free for 30 days. Best of all, it can help you find and fix both performance and memory management issues.
This step is standard. Install JustTrace as you would any piece of software. By default, it will install the integration components to both Visual Studio 2010 and 2012 if they are installed. The standalone tool works with any .NET application from version 2.0 to 4.5.
You can access JustTrace directly through shortcut placed on your desktop. If it is not there, or you removed it, press Start and type JustTrace to find the program in your Programs list.
Depending on the issue you identified in step 1, you will need to select Improve Performance or Fix Memory Problems.
JustTrace works with a variety of application types. Whether you are profiling for performance or for memory, these options are the same. You can have it attach to a local executable, a running application, Silverlight applications, ASP.NET applications hosted in either IIS or Visual Studio Development Server, and even Windows Services.
You will need to choose options based upon your application type. For example, a standalone application requires the path to the executable, and web applications need the web address. After selecting this, click run at the bottom-right of the screen.
If you are running a performance profile, go through the application to record all of its method calls and timings. End the program or click Kill Profilee when you are done. You will notice the CPU Graph updated while you were running. Click this graph and select the period you will analyze in the Timeline window. Then, click Show snapshot.
If you are running the memory profiler, you will need to collect a snapshot while running the application. If you are finished profiling, click Kill & Get.
Your performance snapshot contains several panels of useful information to help you find issues. If you are unsure where to start, look at Hot Spots for potential issues. If you are interested in a particular method, use Method List.
From either of these views, you have the option to view the method’s calls, its callers, or its source code.
The default view for a memory snapshot is the Snapshot Summary. This view shows you important information such as objects in various stages of garbage collection, objects suspected of memory leaks, and objects consume the largest amount of memory.
Other views provide information that is more detailed. Here is a look at the Largest Memory Retainers.
You may be interested in objects keeping one of these larger objects alive. Click the Root Paths button to see a visualization of the object graph.
Notice that a new view is available on the Control panel. JustTrace makes it easy to navigate between various representations of your application’s objects to discover the cause of your memory management issues.
With your analyses in hand, it is time to make changes to your application to improve its performance or memory management. Make your changes and profile again to see if your issue has been resolved.
Chris is a technical evangelist for JustTrace and a C# MVP. Having seen too many leaky applications, he decided it was time to stop reacting and start profiling upfront. The result: more time for happy hour.
Chris Eargle is a Microsoft C# MVP with over a decade of experience designing and developing enterprise applications, and he runs the local .NET User Group: the Columbia Enterprise Developers Guild. He is a frequent guest of conferences and community events promoting best practices and new technologies. Chris is a native Carolinian; his family settled the Dutch Form region of South Carolina in 1752. He currently resides in Columbia with his wife, Binyue, his dog, Laika, and his three cats: Meeko, Tigger, and Sookie. Amazingly, they all get along... except for Meeko, who is by no means meek.
Subscribe to be the first to get our expert-written articles and tutorials for developers!