BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

.NET Memory Profiling in Visual Studio 2013

| by Jonathan Allen Follow 7 Followers on Jun 23, 2013. Estimated reading time: 1 minute |

A common misconception is that .NET developers don’t have to worry about memory management. While it is true that memory is easier to deal with, there are still ways you can get into trouble.

The three most common mistakes made in .NET programming are:

  • Memory leaks, usually via delegates or event handlers that weren’t properly released.
  • Inefficient memory use, basically just holding onto more memory than necessary.
  • Unnecessary allocations, a subtle problem that can become quite expensive over time.

In the preview by Andrew B Hall, Visual Studio 2013 is shown capturing the status of an application running in a production setting. To do this you need a tool called ProcDump to create snapshots of the process’s memory. These dumps can then be loaded into Visual Studio for analysis.

Like other memory profiling tools, Visual Studio 2013 will list how many instances of each object were allocated and via what path they are rooted. (An object that is “rooted” is one that cannot be cleaned by the garbage collector because it is still accessible via a static field or local variable.)

Determining the cause of the memory leak is still left as an exercise for the developer. This makes Visual Studio inferior to the other products on the market. With the right filters, Red Gate’s ANTS Memory Profiler will flag objects that represent common mistakes like the aforementioned event handler based memory leaks. SciTech’s .NET Memory Profiler will even do one better. SciTech includes a summary with warning messages for the memory problems the tool is seeing.

SciTech also beats out Visual Studio 2013 and Red Gate in terms of the details available. Not only does it show you how an object is rooted, it will also show you the call path used to create the object in the first place. Also available are all of the fields on the object.

This is just a preview and more features may be announced in the future, but as it stands Microsoft is still a distant third in terms of .NET memory profiling.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT