Sunday, October 12, 2008

Debugging studies - day 2

I started with Lab #3 today and faced a Windows Vista dummy question immediately - "Where do I setup performance counters/logs?". I bit of exploration led me to the reliability and performance monitor:

image

I just setup the user defined "Data collection set" and started the collection.

Overall, lab 3 was pretty straightforward and fast to complete.

New things I discovered for myself:


Loader heap.
I've seen already with clrprofiler what regex and serialization assemblies can do to the memory, but I didn't realize before that is a special loader heap that is used for them as well as for the regular assemblies to load.

Windows NT memory advanced details.
Whole range of things, driven by non-ability to answer Tess's questions:

Run !address -summary (this will give you an overview of the memory usage) and familiarize yourself with the output. Hint: check the windbg help files for !address Q: Which values corresponds best to the following: Private Bytes, Virtual Bytes
Q: Where is most of the memory going (which RegionType)?
Q: What does Busy, Pct(Busy) and Pct(Tots) mean?
Q: What does MEM_IMAGE mean?
Q: Under what region does .net memory fit in and why?


I continued with Lab 4 and found it very, very fascinating as regardless its name pointing to the high CPU usage, this high CPU usage resulted from the use of string concatenation instead of using a StringBuilder which in turn caused GC time to be up to 70%. That was a fantastic show-case for deciding when to use a StringBuilder over the string concatenation methods (like http://channel9.msdn.com/forums/TechOff/14294-C-string-vs-StringBuilder/) and example of how GC can kill your application performance. That was a tasty bit to debug!

Post a Comment