1 minute read

The purpose of my presentation was to show some common pitfalls and of course to show off windbg and sos just to show people that if you have a hang, perf issue, memory leak or crash, there are tools out there that can help you figure out the root cause so that you don’t have to resort to guessing.

You can find the site I used for the presentation here. The presentation was 60 mins of demos, so no PowerPoint

Hangs and Performance issues

First I debugged a simple hang (using locks in conjunction with long running operations) to show the power of windbg and sos, and to show off a few of the commands. If you want to try it out yourself - it is available as Lab 1 in the Debugging Lab Series.

After this I went into a high CPU in GC scenario with string concatenation and showed a simple example where I reduced the execution time of a page assembling an XML file from 6 seconds to ~2 ms by changing from using string concatenation to using StringBuilder. I had a brief spiel about how the GC works and why string concatenation caused high CPU in GC.

In the performance piece of the talk I also covered dataset serialization, how big the serialized data can become and how you can avoid it using dataset surrogates.

And finally I showed how you can log application restarts.

Memory Leaks

In the memory section I showed a few different leaks caused by blocked finalizers and storing a lot of data in cache/session. And I also showed how you can display all the session variables in a memory dump in order to investigate issues with high memory usage in session variables.

Exceptions and Crashes

I ended off the talk with a discussion on what can cause a crash and why you get out of memory exceptions and finally showed how simple it is to log exceptions using windbg, something I think all developers should do during the testing phase to get a feel for how many exceptions and what types of exceptions their application throws during normal working conditions.

The full presentation has a few more topics but one hour is a bit too short to cover everything :)

Have fun, Tess