<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>PFE - Developer Notes for the Field</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/pfedev/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/pfedev/feed.xml</link>
    <description>Developer PFE</description>
    <lastBuildDate>Tue, 10 Apr 2018 00:20:05 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Azure Short Videos</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/azure-short-videos</link>
      <pubDate>Mon, 09 Apr 2018 22:41:50 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/?p=1025</guid>
      <description><![CDATA[I recently blogged about Azure Short Videos - few topics are still WIP and I'll update them soon....]]></description>
      <content:encoded><![CDATA[<span>I recently blogged about Azure Short Videos - few topics are still WIP and I'll update them soon. However, there are links to hundreds of videos already.</span>

<span>Azure is a fast moving platform with changes coming to it more often and more quickly than ever before. It’s difficult to keep up with the features and how you can take advantage of them. Even I find it difficult to find the right resources. If I need a quick information about say “What is StorSimple?”, the information sometimes isn’t what I’m looking for. So I have compiled a list of short videos that may help you understand the feature or enable you to do some configuration quickly. Do send me a note if you like something or if you don’t or if you come across any good resource!</span>

<span>So have fun learning and understanding <strong><a href="https://blogs.msdn.microsoft.com/prakashpatel/">Azure Short Videos</a></strong>!</span>]]></content:encoded>
    </item>
    <item>
      <title>Transforming Performance Monitor data from graphs to spreadsheets</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/transforming-performance-monitor-data-from-graphs-to-spreadsheets</link>
      <pubDate>Thu, 27 Jul 2017 14:21:40 GMT</pubDate>
      <dc:creator><![CDATA[Brad L]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/?p=1005</guid>
      <description><![CDATA[After troubleshooting Windows applications for more than 10 years here at Microsoft, I have found...]]></description>
      <content:encoded><![CDATA[After troubleshooting Windows applications for more than 10 years here at Microsoft, I have found Performance Monitor (aka Perfmon, aka System Monitor, aka Sysmon) to be one of the most highly effective and under-utilized tools to help diagnose and define application performance &amp; stability problems. Perfmon can be critical in helping diagnose memory leaks, longer-than-expected request execution times, unexpected process termination, potential backend issues that hang an ASP.NET application and many other kinds of problems. Although it rarely, if ever, will reveal root cause of a problem, it does an excellent job at helping to define your application problem. One can’t start effective troubleshooting with the goal of root cause isolation &amp; remediation until the problem is accurately defined. Perfmon’s graphs show trends over time, and this in itself can be key to defining and diagnosing an issue such as memory leaks.

Sometimes graphs can be confusing or simply unhelpful. Such is the case for me when I use Perfmon data to show a customer how their subsequent release builds may contain performance problems. Below is a snapshot of a Perfmon log for a server running IIS which hosts over 60 ASP.NET applications. And keep in mind, the graph displayed in this Perfmon log is for only one counter (ASP.NET Applications/Request Execution Time) over the course of one day!

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ExhA.jpg"><img width="537" height="422" title="ExhA" alt="ExhA" src="https://msdnshared.blob.core.windows.net/media/2017/07/ExhA_thumb.jpg" border="0" /></a>

<b>Exhibit A: Sample Perfmon graph</b>

The goal for me here was to compare these trends to the same diagnostic information from an earlier build, after a new build of the code was released. This would entail comparing these line graphs to another set of confusing line graphs. And this is for just one counter, imagine doing this for four or five counters. Talk about a migraine-inducing exercise!

Rather than present a series of graphs for several ASP.NET applications, covering several hours and include counters to show cpu usage, memory usage, request execution time, etc., I decided it might be easier for the customer to consume the data if was presented in a spreadsheet format. One column could contain the average cpu usage in a day and subsequent columns could contain counter data such as the maximum cpu usage, average or maximum committed memory, etc. I found customers prefer this layout and find the data in this format easier to identify trends. Here’s an example of what the data looks like in a spreadsheet format:

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ExhB.jpg"><img width="541" height="221" title="ExhB" alt="ExhB" src="https://msdnshared.blob.core.windows.net/media/2017/07/ExhB_thumb.jpg" border="0" /></a>

<b>Exhibit B: Perfmon data in a spreadsheet</b>

Exhibit B displays how much easier it is to identify trends amidst all this data. Simply compare spreadsheets which contain the data from releases over time, and the application with a performance problem will reveal itself. With Excel’s sorting and filtering features the customer can customize the view of data to their liking.

There’s just one problem in going from Exhibit A to Exhibit B – how do you extract the data from Perfmon into the spreadsheet? You could manually type the names of the ASP.NET applications and the data points into Excel, but that is an error prone, time-consuming process – even if you’re monitoring a small set of applications.

Brian Mallon, a colleague at Microsoft, showed me an invaluable tip to achieve my goal with less manual effort. Many thanks to Brian for sharing this tip that saved me literally hours for every time I need to do this going forward. You can find out more about Brian by viewing his <a href="http://www.linkedin.com/in/brmallon">LinkedIn</a> profile.

<b>Step1: Saved the data to a .tsv file</b>

The first step in moving data from Perfmon to a spreadsheet display is to make sure all the counters of interest are added in the graph. Then right-click anywhere in the graph area and select Save Settings As…

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ExhC.jpg"><img width="543" height="422" title="ExhC" alt="ExhC" src="https://msdnshared.blob.core.windows.net/media/2017/07/ExhC_thumb.jpg" border="0" /></a>

<b>Exhibit C: Saving out Perfmon data points</b>

In the Save As dialog, select “Report (*.tsv)” in the Save as type dropdown. Give the file a name and save it wherever you like.

<b>Step2: Open the data in Excel and format to your liking.</b>

Once you’ve saved the tsv file from Perfmon, open it in Excel. You will notice that counters are listed in rows, and instances are listed in columns (if in fact your counter has instances). Some objects, such as Memory and ASP.NET, do not have instances while other objects, such as ASP.NET Applications and Process, do.

In my example in Exhibit C, I only had one counter from one object displayed in Perfmon – ASP.NET Applications\Request Execution Time. Because the instance names for this object are all pre-pended with the text “_LM_W3SVC_&lt;nbr&gt;_ROOT”, they are all quite long. You need to expand the Instance column to see the names of each ASP.NET application.

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ExhD.jpg"><img width="523" height="203" title="ExhD" alt="ExhD" src="https://msdnshared.blob.core.windows.net/media/2017/07/ExhD_thumb.jpg" border="0" /></a>

<b>Exhibit D: Viewing data points (average values) in Excel</b>

Depending on how you like to view the data, you may or may not like the counter names in rows and the instances (in this case, it’s the ASP.NET application names for the ASP.NET\Request Execution Time counter) in columns. If you want to transpose the layout such that the instance names are in rows &amp; the counter names are in columns, follow these simple steps.

1. Select all the data you want transposed, including the column &amp; row headers.

2. Copy it to the clipboard.

3. Right-click inside an empty cell that has plenty of space below &amp; to the right of it for the transposed data. Select the Paste Option for Transpose.

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ExhE.jpg"><img width="446" height="477" title="ExhE" alt="ExhE" src="https://msdnshared.blob.core.windows.net/media/2017/07/ExhE_thumb.jpg" border="0" /></a>

<b>Exhibit E: Transposing data in Excel</b>

You may notice these numbers are the averages over the time span displayed in Perfmon. But what if you’re tracking a metric whose <i>maximum (or minimum)</i> value is of interest to you – such as cpu usage or Requests/sec? How do you extract those data points from Perfmon?

All you need to do is go back to Perfmon and extract the data again (see Exhibit C), but first make one minor modification within Perfmon. Before you select ‘Save Settings As’ in Perfmon’s context menu, right click anywhere on the graph in Perfmon and select Properties. Go to the General tab and in the ‘Report and histogram data’ section and select the option (minimum, maximum, etc.) which represents the data points you wish to see in Excel. Now repeat Steps 1 &amp; 2 above.

<a href="https://msdnshared.blob.core.windows.net/media/2017/07/ExhF.jpg"><img width="463" height="333" title="ExhF" alt="ExhF" src="https://msdnshared.blob.core.windows.net/media/2017/07/ExhF_thumb.jpg" border="0" /></a>

<b>Exhibit F: You can export minimum, maximum, current, or average values for desired counters</b>

Format, sort, filter, and massage the data in Excel to your preference. Sometimes this process of finding the “right” display of data can take several attempts. And what works for one person may not work for another. For the Microsoft customers I work with, who have large scale ASP.NET web sites, a common set of metrics are cpu usage, memory (Process\Private Bytes as well as .NET CLR Memory\#Total Committed Bytes), Requests/sec, Requests Executing, and a few other assorted counters.

When the customer has many ASP.NET applications (e.g., more than 15) and is trying to view trends over time to see if they are introducing regressions that result in increased resource usage (cpu, memory), increased load, or something else that adversely affects the performance of their web site, presenting this data in a spreadsheet style for comparison across releases can provide great value. Some of the more common counters I’ve used for are in an old Patterns &amp; Practices book at <a href="https://msdn.microsoft.com/en-us/library/ms998530.aspx">https://msdn.microsoft.com/en-us/library/ms998530.aspx</a>. Old paper, but many of the counters are still quite helpful in diagnosing &amp; defining .NET application performance &amp; stability issues.

This small step that essentially allows us to move data points from Perfmon’s graph style to Excel’s spreadsheet style can save a large amount of time and decrease the number of mistakes that occur from manually copying data.]]></content:encoded>
    </item>
    <item>
      <title>VS2015 Remote Debugging JavaScript – Resources</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/vs2015-remote-debugging-javascript-resources</link>
      <pubDate>Thu, 05 Nov 2015 21:04:05 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2015/11/05/vs2015-remote-debugging-javascript-resources/</guid>
      <description><![CDATA[Some of the resource I have found useful in the past. I'll keep updating the list as and when I find...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Calibri; font-size: small;">Some of the resource I have found useful in the past. I'll keep updating the list as and when I find good article. Please feel free to send me your list too! If you are a debugging guru and you like to deal with bit and bytes then you may find following...</span></p>
<p><span style="font-family: Calibri; font-size: small;">Complete blog is published here: </span><a href="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/06/vs2015-remote-debugging-javascript-resources.aspx"><span style="color: #0000ff; font-family: Calibri; font-size: small;">VS2015 Remote Debugging JavaScript &ndash; Resources</span></a></p>
<p><em><span style="font-family: Calibri; font-size: small;">Direct / Alternate links</span></em></p>
<p><span style="font-family: Calibri; font-size: small;">1. </span><a href="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/06/vs2015-remote-debugging-javascript-resources.aspx"><span style="color: #0000ff; font-family: Calibri; font-size: small;">http://blogs.msdn.com/b/prakashpatel/archive/2015/11/06/vs2015-remote-debugging-javascript-resources.aspx</span></a></p>
<p><span style="font-family: Calibri; font-size: small;">2. </span><a href="http://blogs.technet.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-resources.aspx"><span style="color: #0000ff; font-family: Calibri; font-size: small;">http://blogs.technet.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-resources.aspx</span></a></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>]]></content:encoded>
    </item>
    <item>
      <title>VS2015 Remote Debugging JavaScript – Part 3 (F12Chooser)</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/vs2015-remote-debugging-javascript-part-3-f12chooser</link>
      <pubDate>Thu, 05 Nov 2015 20:32:00 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser/</guid>
      <description><![CDATA[F12Chooser: Amazing New Tool for WinForms Application Hosting Web Browser Control Earlier we talked...]]></description>
      <content:encoded><![CDATA[<p>F12Chooser: Amazing New Tool for WinForms Application Hosting Web Browser Control Earlier we talked about how to debug JavaScript remotely from Internet Explorer and any other process. If you haven't read the post, then here are the links. http:/...</p>
<p>Complete blog is published here: <a class="internal-link view-post" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx">VS2015 Remote Debugging JavaScript &ndash; Part 3 (F12Chooser)</a></p>
<p><em>Direct / Alternate links</em></p>
<p>1. <a title="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx">http://blogs.msdn.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx</a></p>
<p>2. <a title="http://blogs.technet.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx" href="http://blogs.technet.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx">http://blogs.technet.com/b/prakashpatel/archive/2015/11/05/vs2015-remote-debugging-javascript-part-3-f12chooser.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>VS2015 Remote Debugging JavaScript – Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/vs2015-remote-debugging-javascript-part-2</link>
      <pubDate>Thu, 05 Nov 2015 20:25:00 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2015/11/05/vs2015-remote-debugging-javascript-part-2/</guid>
      <description><![CDATA[VS2015 Remote Debugging JavaScript Hosted in Web Browser Control Earlier we talked about how to...]]></description>
      <content:encoded><![CDATA[<div class="post-date">VS2015 Remote Debugging JavaScript Hosted in Web Browser Control Earlier we talked about how to debug JavaScript remotely from Internet Explorer process. This one does not differ at all from it. All you need to do is select different target process...</div>
<div class="post-date">
<p>Complete blog is published here: <a class="internal-link view-post" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx">VS2015 Remote Debugging JavaScript &ndash; Part 2</a></p>
<p><em>Direct / Alternate links</em></p>
<p>1. <a title="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx">http://blogs.msdn.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx</a></p>
<p>2. <a title="http://blogs.technet.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/<div class=&quot;post-date&quot;><p>http:/blogs.technet.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx</p></div>">http://blogs.technet.com/b/prakashpatel/archive/2015/11/04/vs2015-remote-debugging-javascript-part-2.aspx</a></p>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Internet Explorer or .NET Application Hosting Web Browser May Crash with Exception 0xE06D7363</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363</link>
      <pubDate>Thu, 29 Oct 2015 14:52:00 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363/</guid>
      <description><![CDATA[This month looks little unusual as I ran into another bug in Internet Explorer component....]]></description>
      <content:encoded><![CDATA[<p>This month looks little unusual as I ran into another bug in Internet Explorer component. Jscript9.dll is a core dll for implementing JavaScript engine (aka Chakra engine). The process may crash with C++ Exception code E06D7363. Here are some of the details...</p>
<p>Complete blog is published here: <a class="internal-link view-post" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx">Internet Explorer or .NET Application Hosting Web Browser May Crash with Exception 0xE06D7363</a></p>
<p><em>Direct / Alternate links</em></p>
<p>1. <a title="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx">http://blogs.msdn.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx</a></p>
<p>2. <a title="http://blogs.technet.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx" href="http://blogs.technet.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx">http://blogs.technet.com/b/prakashpatel/archive/2015/10/29/internet-explorer-or-net-application-hosting-web-browser-may-crash-with-exception-0xe06d7363.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>.NET Application Hosting Web Browser Control Freezes / Hangs During Start Up</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/net-application-hosting-web-browser-control-freezes-hangs-during-start-up</link>
      <pubDate>Thu, 29 Oct 2015 14:50:00 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2015/10/29/net-application-hosting-web-browser-control-freezes-hangs-during-start-up/</guid>
      <description><![CDATA[Background Recently, I ran into few incidents where .NET Application hosting web browser control was...]]></description>
      <content:encoded><![CDATA[<p>Background Recently, I ran into few incidents where .NET Application hosting web browser control was hanging during start up. When I investigated dump file, I found out that the hang has nothing to do with the .NET or JavaScript or Web Browser Control...</p>
<p>Complete blog is published here: <a class="internal-link view-post" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/24/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx">.NET Application Hosting Web Browser Control Freezes / Hangs During Start Up</a></p>
<p><em>Direct / Alternate links</em></p>
<p>1. <a title="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/24/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/24/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx">http://blogs.msdn.com/b/prakashpatel/archive/2015/10/24/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx</a></p>
<p>2. <a title="http://blogs.technet.com/b/prakashpatel/archive/2015/10/23/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx" href="http://blogs.technet.com/b/prakashpatel/archive/2015/10/23/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx">http://blogs.technet.com/b/prakashpatel/archive/2015/10/23/net-application-hosting-web-browser-control-freezes-hangs-during-start-up.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>VS2015 Remote Debugging JavaScript – Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/vs2015-remote-debugging-javascript-part-1</link>
      <pubDate>Thu, 29 Oct 2015 14:48:00 GMT</pubDate>
      <dc:creator><![CDATA[Prakash Patel]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2015/10/29/vs2015-remote-debugging-javascript-part-1/</guid>
      <description><![CDATA[VS2015 provides first class experience for debugging JavaScript code. You can leverage remote...]]></description>
      <content:encoded><![CDATA[<p>VS2015 provides first class experience for debugging JavaScript code. You can leverage remote debugging features to debug JavaScript code on remote machine. The process can be internet explorer process or Windows Store App or it could even be a .NET application...</p>
<p>Complete blog is published here: <a class="internal-link view-post" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx">VS2015 Remote Debugging JavaScript</a></p>
<p><em>Direct / Alternate links</em></p>
<p>1. <a title="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx" href="http://blogs.msdn.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx">http://blogs.msdn.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx</a></p>
<p>2. <a title="http://blogs.technet.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx" href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/<p>http:/blogs.technet.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx</p>">http://blogs.technet.com/b/prakashpatel/archive/2015/10/23/vs2015-remote-debugging-javascript.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Finally... JavaScript source line info in a dump</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/finally-javascript-source-line-info-in-a-dump</link>
      <pubDate>Mon, 29 Sep 2014 10:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Brad L]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2014/09/29/finally-javascript-source-line-info-in-a-dump/</guid>
      <description><![CDATA[For many years, if your C/C++/.NET application had a performance or stability issue (e.g.,...]]></description>
      <content:encoded><![CDATA[<p>For many years, if your C/C++/.NET application had a performance or stability issue (e.g., unresponsiveness, crash, high cpu consumption, etc.), one of the popular - and effective - ways to troubleshoot the problem was to dump the process when the problem symptom surfaced.&nbsp; And when you open the user mode dump with windbg or cdb, you get a stack trace for each thread in the process.</p>
<ul>
<li>If you have matching private symbols for the native (e.g., non-.NET) assemblies, you'll get source line information for those frames.</li>
<li>For frames involving managed assemblies, source line information hasn't been available since the 1.x days.&nbsp; But you can use commands from SOS such as !u to get close to the line of source executing when the dump was written.</li>
</ul>
<p>But what if your process is executing JavaScript and you want to understand what line of JavaScript is executing?&nbsp; For the sake of argument, let's assume you're dealing with IE9 or later where the re-vamped JavaScript engine lives in jscript9.dll.&nbsp;&nbsp;Matching symbols&nbsp;isn't much help in determining what line of JavaScript code was executing, or even which .js file.&nbsp; Even if you have private symbols&nbsp;- which, as a Microsoft employee, I have access to&nbsp;- it isn't a straightforward exercise to extract this information.&nbsp; The following is an example stack of what is revealed.&nbsp; As you can see, there are no pointers to JavaScript source.</p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;">ChildEBP RetAddr&nbsp; </span><br /><span style="font-family: courier new,courier;">000b8e7c 7542790d user32!NtUserGetMessage+0x15</span><br /><span style="font-family: courier new,courier;">000b8e98 6f8b8377 user32!GetMessageW+0x33</span><br /><span style="font-family: courier new,courier;">000b8f14 6f7f88ca mshtml!InternalShowModalDialog+0x28a</span><br /><span style="font-family: courier new,courier;">000baf94 6f7f8a6b mshtml!CWindow::ShowHTMLDialogHelper+0x49c</span><br /><span style="font-family: courier new,courier;">000bb00c 6f8a0883 mshtml!CWindow::showModalDialog+0x60 </span><br /><span style="font-family: courier new,courier;">000bb080 6f54ab59 mshtml!Method_VARIANTp_BSTR_o0oVARIANTp_o0oVARIANTp+0x13d</span><br /><span style="font-family: courier new,courier;">000bb104 6f436fe3 mshtml!CBase::ContextInvokeEx+0x84c</span><br /><span style="font-family: courier new,courier;">000bb130 6f4397af mshtml!CSelectionObject::InvokeEx+0x2b</span><br /><span style="font-family: courier new,courier;">000bb184 6f439c29 mshtml!DispatchInvokeCollection+0x1ab</span><br /><span style="font-family: courier new,courier;">000bd214 6f458a64 mshtml!CWindow::InvokeEx+0x5ca</span><br /><span style="font-family: courier new,courier;">000bd240 6f458664 mshtml!CBase::VersionedInvokeEx+0x37</span><br /><span style="font-family: courier new,courier;">000bd280 6f439142 mshtml!CBase::PrivateInvokeEx+0x82</span><br /><span style="font-family: courier new,courier;">000bd2ec 6f439204 mshtml!COmWindowProxy::InvokeEx+0x270</span><br /><span style="font-family: courier new,courier;">000bd314 6f458a64 mshtml!COmWindowProxy::subInvokeEx+0x26</span><br /><span style="font-family: courier new,courier;">000bd340 6f4392a9 mshtml!CBase::VersionedInvokeEx+0x37</span><br /><span style="font-family: courier new,courier;">000bd380 580acbb7 mshtml!PlainInvokeEx+0x95</span><br /><span style="font-family: courier new,courier;">000bd3c8 580b2eeb jscript9!HostDispatch::CallInvokeEx+0x106</span><br /><span style="font-family: courier new,courier;">000bd3f0 580b2e35 jscript9!HostDispatch::InvokeMarshaled+0x4d</span><br /><span style="font-family: courier new,courier;">000bd4cc 580b2c50 jscript9!HostDispatch::InvokeByDispId+0x408</span><br /><span style="font-family: courier new,courier;">000bd4e8 580b2c24 jscript9!DispMemberProxy::DefaultInvoke+0x22</span><br /><span style="font-family: courier new,courier;">000bd500 580685fe jscript9!DispMemberProxy::DefaultInvoke+0x20</span><br /><span style="font-family: courier new,courier;">000bd540 580b375a jscript9!Js::JavascriptFunction::CallFunction+0xc4</span><br /><span style="font-family: courier new,courier;">000bd564 580b3703 jscript9!Js::InterpreterStackFrame::OP_CallFld+0x58</span><br /><span style="font-family: courier new,courier;">000bd594 580ccadb jscript9!Js::InterpreterStackFrame::Process+0x7ae</span><br /><span style="font-family: courier new,courier;">000bd5c4 580cca50 jscript9!Js::InterpreterStackFrame::ProcessThunk+0x65</span><br /><span style="font-family: courier new,courier;">000bd6b0 580685fe jscript9!Js::InterpreterStackFrame::InterpreterThunk+0x21f</span><br /><span style="font-family: courier new,courier;">000bd6f0 580b375a jscript9!Js::JavascriptFunction::CallFunction+0xc4</span><br /><span style="font-family: courier new,courier;">000bd714 580b3796 jscript9!Js::InterpreterStackFrame::OP_CallFld+0x58</span><br /><span style="font-family: courier new,courier;">000bd744 580ccadb jscript9!Js::InterpreterStackFrame::Process+0x7c7</span><br /><span style="font-family: courier new,courier;">000bd774 580cca50 jscript9!Js::InterpreterStackFrame::ProcessThunk+0x65</span><br /><span style="font-family: courier new,courier;">000bd838 580685fe jscript9!Js::InterpreterStackFrame::InterpreterThunk+0x21f</span><br /><span style="font-family: courier new,courier;">000bd86c 58068523 jscript9!Js::JavascriptFunction::CallFunction+0xc4</span><br /><span style="font-family: courier new,courier;">000bd8d0 5806845a jscript9!Js::JavascriptFunction::CallRootFunction+0xb6</span><br /><span style="font-family: courier new,courier;">000bd90c 580683e6 jscript9!ScriptSite::CallRootFunction+0x4f</span><br /><span style="font-family: courier new,courier;">000bd934 58093522 jscript9!ScriptSite::Execute+0x63</span><br /><span style="font-family: courier new,courier;">000bd9c0 580933bb jscript9!ScriptEngine::ExecutePendingScripts+0x319</span><br /><span style="font-family: courier new,courier;">000bda64 58094c46 jscript9!ScriptEngine::ParseScriptTextCore+0x33c</span><br /><span style="font-family: courier new,courier;">000bdab0 6f4f0108 jscript9!ScriptEngine::ParseScriptText+0x67</span><br /><span style="font-family: courier new,courier;">000bdae8 6f4afb95 mshtml!CActiveScriptHolder::ParseScriptText+0xc7</span><br /><span style="font-family: courier new,courier;">000bdb58 6f4f108f mshtml!CScriptCollection::ParseScriptText+0x2d2</span><br /><span style="font-family: courier new,courier;">000bdc3c 6f4f0dde mshtml!CScriptData::CommitCode+0x4ea</span><br /><span style="font-family: courier new,courier;">000bdc8c 6f331d9e mshtml!CScriptData::Execute+0x1fc</span><br /><span style="font-family: courier new,courier;">000bdcb8 6f4aff93 mshtml!CScriptData::ScriptData_OnEnterTree+0x240</span></p>
<p><span style="font-family: arial,helvetica,sans-serif;">So if</span> you have a random&nbsp;issue involving JavaScript that can't be reproduced on demand, and you can't repro&nbsp;outside of production, your options of getting a stack of the problem are limited to a dump or a profiler.&nbsp; But in neither case were you able to easily get source line information for the JavaScript portion of the code.&nbsp; At least, until now.</p>
<p>&nbsp;</p>
<p>When you use the latest&nbsp;debugger engine in the <a title="Windows 8.1 SDK" href="http://msdn.microsoft.com/en-US/windows/desktop/bg162891">Windows 8.1 SDK</a> to create and view a dump of&nbsp;IE11 on Windows 8.1, your stack will show you frames you never saw before.&nbsp; The numbers at the end of the highlighted frames represent column &amp; row numbers:</p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;">ChildEBP RetAddr&nbsp; </span><br /><span style="font-family: courier new,courier;">(Inline) -------- jscript9!Js::TaggedInt::IsPair+0x9</span><br /><span style="font-family: courier new,courier;">0cc6ebb0 074600b9 jscript9!Js::SSE2::JavascriptMath::Modulus_InPlace+0x11</span><br /><span style="font-family: courier new,courier;">WARNING: Frame IP not in any known module. Following frames may be wrong.</span><br /><span style="font-family: courier new,courier;">0cc6ec30 64bd4094 <span style="background-color: #ffff00;">js!UTIL.powerLoop1 [http://pmav.eu/stuff/javascript-webworkers/assets/js/javascript-webworkers-v1.4.0.js @ 367,17]</span></span><br /><span style="font-family: courier new,courier;">0cc6ef78 64b46548 jscript9!Js::InterpreterStackFrame::Process+0x34b1</span><br /><span style="font-family: courier new,courier;">0cc6f09c 05d10fc1 jscript9!Js::InterpreterStackFrame::InterpreterThunk&lt;1&gt;+0x1e8</span><br /><span style="font-family: courier new,courier;">0cc6f0a8 64b4669e <span style="background-color: #ffff00;">js!UTIL.power [http://pmav.eu/stuff/javascript-webworkers/assets/js/javascript-webworkers-v1.4.0.js @ 367,17]</span><br /></span><span style="font-family: courier new,courier;">0cc6f3f8 64b46548 jscript9!Js::InterpreterStackFrame::Process+0xbd7</span><br /><span style="font-family: courier new,courier;">0cc6f53c 05d10fc9 jscript9!Js::InterpreterStackFrame::InterpreterThunk&lt;1&gt;+0x1e8</span><br /><span style="font-family: courier new,courier;">0cc6f548 64b40685 <span style="background-color: #ffff00;">js!onmessage [http://pmav.eu/stuff/javascript-webworkers/assets/js/javascript-webworkers-v1.4.0.js @ 323,17]</span><br /></span><span style="font-family: courier new,courier;">0cc6f590 64b4100e jscript9!Js::JavascriptFunction::CallFunction&lt;1&gt;+0x88</span><br /><span style="font-family: courier new,courier;">0cc6f5fc 64b40f60 jscript9!Js::JavascriptFunction::CallRootFunction+0x93</span><br /><span style="font-family: courier new,courier;">0cc6f644 64b40ee7 jscript9!ScriptSite::CallRootFunction+0x42</span><br /><span style="font-family: courier new,courier;">0cc6f66c 64b4993c jscript9!ScriptSite::Execute+0x6c</span><br /><span style="font-family: courier new,courier;">0cc6f6c8 64b49878 jscript9!ScriptEngineBase::ExecuteInternal&lt;0&gt;+0xbb</span><br /><span style="font-family: courier new,courier;">0cc6f6e0 6732b78f jscript9!ScriptEngineBase::Execute+0x1c</span><br /><span style="font-family: courier new,courier;">0cc6f794 6732b67c mshtml!CListenerDispatch::InvokeVar+0x102</span><br /><span style="font-family: courier new,courier;">0cc6f7c0 6732b21e mshtml!CListenerDispatch::Invoke+0x61</span><br /><span style="font-family: courier new,courier;">0cc6f858 6732b385 mshtml!CEventMgr::_InvokeListeners+0x1a2</span><br /><span style="font-family: courier new,courier;">0cc6f9cc 67245ecc mshtml!CEventMgr::Dispatch+0x35a</span><br /><span style="font-family: courier new,courier;">0cc6fa08 6721eb22 mshtml!CMessagePort::HandlePostMessage+0x207</span><br /><span style="font-family: courier new,courier;">0cc6fa10 6721ed2c mshtml!CMessagePort::HandleNotification+0x2e</span></p>
<p style="padding-left: 30px;"><span style="font-family: courier new,courier;">&lt;clip&gt;</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial,helvetica,sans-serif;">If you're not having success seeing these JavaScript frames in your dumps, here's a quick checklist I compiled during my testing.</span></p>
<ul>
<li><span style="font-family: arial,helvetica,sans-serif;">This is not supported on any OS prior to 8.1.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">This is supported for any process that loads jscript9.dll. This includes processes which host the&nbsp;browser control for IE11.&nbsp; Note I only tested iexplore.exe.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">You'll need to create *and* view the dump with the debugger engine (used by windbg &amp; cdb) that comes with the 8.1 SDK noted in the link I pasted above.&nbsp; Older versions of the debuggers may not work.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">Dumps created with DebugDiag v2.0 U1 do not currently yield the JS frames.&nbsp; But I've had luck replacing the dbghelp.dll that ships with DebugDiag with the build that ships with the 8.1 SDK.&nbsp;&nbsp;The next release of DebugDiag is scheduled to include a build of dbghelp.dll that will reveal these JS frames.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">If you use adplus_old.vbs to create the dump, you may consider making an edit in the file.&nbsp; After you make a copy of the original .vbs, replace all calls to ".dump -u /ma" with "dump /ma".</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">JS frames will not resolve in a live debug.&nbsp; This is currently only supported in a post-mortem dump.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">Be sure the process you're dumping has JavaScript executing at the time of the dump.&nbsp; Otherwise, you're unlikely to see any of the JS frames.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">As always, it's a best practice to keep the architectures of the debugger and target aligned:</span></li>
<ul>
<li><span style="font-family: arial,helvetica,sans-serif;">Dump a 32-bit process with a 32-bit debugger, and&nbsp;open the dump with a 32-bit debugger.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">Dump a 64-bit process with a 64-bit debugger, and&nbsp;open the dump with a 64-bit debugger.</span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">With DebugDiag, install the 32-bit version on a 32-bit OS and install the 64-bit version on a 64-bit OS.&nbsp; In the latter case, DebugDiag automagically determines the debugger bitness to use against the target process.</span></li>
</ul>
<li><span style="font-family: arial,helvetica,sans-serif;">If you've followed all the steps above and are still having problems getting the JS frames to display, ensure the following registry keys have these values.&nbsp; </span></li>
<ul>
<li><span style="font-family: arial,helvetica,sans-serif;">[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MiniDumpAuxiliaryDlls, <span style="color: #888888;">C:\Windows\system32\jscript9.dll = [REG_SZ] C:\Windows\System32\jscript9diag.dll</span></span></li>
<li><span style="font-family: arial,helvetica,sans-serif;">[HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\MiniDumpAuxiliaryDlls], <span style="color: #888888;">C:\Windows\system32\jscript9.dll = [REG_SZ] C:\Windows\SysWOW64\jscript9diag.dll</span></span></li>
</ul>
</ul>
<p>&nbsp;</p>
<p><span style="color: #000000; font-family: arial,helvetica,sans-serif;">While the post-mortem debugging experience with JavaScript still isn't as mature as what we've enjoyed for years with .NET or C/C++, the ability to get the source file and line information removes the first significant blocker - now you can easily see what was executing when the process was dumped.</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Extracting Pictures from a Byte Array in a Memory Dump</title>
      <link>https://docs.microsoft.com/archive/blogs/pfedev/extracting-pictures-from-a-byte-array-in-a-memory-dump</link>
      <pubDate>Wed, 02 Jan 2013 12:13:00 GMT</pubDate>
      <dc:creator><![CDATA[jmattheus]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/pfedev/2013/01/02/extracting-pictures-from-a-byte-array-in-a-memory-dump/</guid>
      <description><![CDATA[&nbsp;
I ran into a case recently where there was a large amount of memory being used in a 32 bit...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>I ran into a case recently where there was a large amount of memory being used in a 32 bit IIS process leading to an out of memory exception.&nbsp; The steps to getting the correct data are documented all over the place.&nbsp; Here&rsquo;s the link to Tess&rsquo; site that I learned on: <a title="http://blogs.msdn.com/b/tess/archive/2008/02/15/net-debugging-demos-lab-3-memory.aspx" href="http://blogs.msdn.com/b/tess/archive/2008/02/15/net-debugging-demos-lab-3-memory.aspx">http://blogs.msdn.com/b/tess/archive/2008/02/15/net-debugging-demos-lab-3-memory.aspx</a></p>
<p>&nbsp;</p>
<p>I&rsquo;ll skip the setup and go straight to the debug of the high memory usage dump.&nbsp; To start with, as always when I&rsquo;m debugging, we start with what we know:</p>
<ul>
<li>Managed application running in IIS</li>
<li>32 bit</li>
<li>Higher than expected memory usage</li>
</ul>
<p>&nbsp;</p>
<p>Our next step is to list what we need to know:</p>
<ul>
<li>How much memory is being used?</li>
<li>Manged or Native?</li>
<li>Leak or heavy usage?</li>
<li>What can we do about it?</li>
</ul>
<p>&nbsp;</p>
<p>The first thing to do is figure out where the memory usage is, and whether it&rsquo;s managed or Native.</p>
<p>&nbsp;</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; !address -summary</p>
<p>--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal <br />Free&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 280&nbsp;&nbsp;&nbsp;&nbsp;&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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 624000 (&nbsp;&nbsp; 6.141 Mb)&nbsp;&nbsp; 0.51%&nbsp;&nbsp;&nbsp; 0.30%</p>
<p>--- State Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal <br /><strong>MEM_COMMIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1823&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 369e6000 ( 873.898 Mb)&nbsp; 73.17%&nbsp;&nbsp; 42.67% </strong> <br /> MEM_FREE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 280&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 355ac000 ( 853.672 Mb)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 41.68% <br /> MEM_RESERVE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 437&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1405e000 ( 320.367 Mb)&nbsp; 26.83%&nbsp;&nbsp; 15.64%</p>
</div>
<p>The memory usage we&rsquo;re concerned about is any committed memory as that will usually be close to the Private Bytes that value in PerfMon.&nbsp; This is shown in the State Summary section as MEM_COMMIT and is currently at approximately 874 MB.&nbsp; We can tell a few other things from the results above by comparing State, Type, and Usage.&nbsp;&nbsp;&nbsp; For one, generally the majority of Image memory will be of state MEM_COMMIT.&nbsp; Right off the bat, we can extract about 292 MB from MEM_COMMIT leaving us with about 582 MB to place still.&nbsp;&nbsp; If we look at the Usage summary, we can see that 840 MB is from &lt;unknown&gt;.&nbsp; That memory usage most often comes from Virtual Allocations.&nbsp; It&rsquo;s also where any managed memory will be.&nbsp; Going back to our MEM_COMMIT memory, it seems likely that the majority of the 58 2MB will be handled fall under this bucket.&nbsp; We don&rsquo;t see much memory at all in Heap, so we can conclude that the memory is either allocated by managed memory, or by a native component making use of a managed allocator.</p>
<p>The next step is to look at managed memory and see if we have around 500 MB of memory usage.&nbsp; We can do that by loading psscor and running !clrusage.</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; .load psscor2 <br />0:000&gt; !clrusage <br />Native Heap for aspnet_filter: 0x01220000 <br />Native Heap for .NET: 0x01fd0000 <br />Number of GC Heaps: 8 <br />Heap Size&nbsp; 0x62fb198(103,788,952) <br />Heap Size&nbsp; 0x303c5b8(50,578,872) <br />Heap Size&nbsp; 0x41e9e58(69,115,480) <br />Heap Size&nbsp; 0x2ca3010(46,805,008) <br />Heap Size&nbsp; 0x3f8209c(66,592,924) <br />Heap Size&nbsp; 0x25b3b68(39,533,416) <br />Heap Size&nbsp; 0x20b5a18(34,298,392) <br />Heap Size&nbsp; 0x17a65a8(24,798,632) <br />May contain Reserved segments, run with -v switch to see them. <br />------------------------------ <br />GC Heap Size&nbsp; 0x19f5617c(435,511,676) <br /><strong>Total Commit Size&nbsp; 1f9f8000 (505 MB)</strong> <br />Total Reserved Size&nbsp; 11608000 (278 MB) <br />Initial reservation type: All at once <br />Initial Allocation Size: 18000000 (402,653,184) (384 MB) <br />Reserved Memory Size: 31000000 (822,083,584) (784 MB) <br />Reserved Memory Limit Size: 31000000 (822,083,584) (784 MB)</p>
</div>
<p>The managed committed memory is 505MB.&nbsp; This lines up with what we were expecting to see if the memory pressure came from managed memory.&nbsp; That means we&rsquo;re investigating a managed memory issue.&nbsp; We can now move on to seeing what is taking up all of the managed memory by using !dumpheap -stat</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; !dumpheap -stat <br /> Using our cache to search the heap. <br /> 0x7aa50c98&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12 System.Diagnostics.CounterCreationDataCollection <br /> 0x7aa40c38&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12 System.ComponentModel.Design.RuntimeLicenseContext <br /> 0x7a5eed4c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12 System.ComponentModel.WeakHashtable+WeakKeyComparer <br /> 0x7a5eeb38&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12 System.ComponentModel.BooleanConverter</p>
<p>&lt;snipped for brevity&gt;</p>
<p>0x000e8600&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 521&nbsp;&nbsp;&nbsp; 24,483,528&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Free <br /> 0x02af0c6c&nbsp;&nbsp;&nbsp; 119,732&nbsp;&nbsp;&nbsp; 74,368,372 System.String <br /> 0x02af36dc&nbsp;&nbsp;&nbsp;&nbsp; 11,634&nbsp;&nbsp; 313,028,160 System.Byte[] <br /> Total 672,044 objects, Total size: 435,460,280</p>
<p>&nbsp;</p>
</div>
<p>Right away, those Byte arrays stand out.&nbsp; It should be stated, that we usually expect to see Byte arrays at the bottom of the list, but as there are 313 MB of them here, it&rsquo;s definitely something we want to look into.</p>
<p>There are a couple ways to proceed.&nbsp; We could dump all byte arrays and look for a pattern in the sizes, or we could look for large byte arrays.&nbsp; We&rsquo;ll start with large byte arrays.&nbsp; By large, we mean anything that would have ended up in the large object heap.&nbsp; Since we know LoH objects are all greater than or equal to 85,000 bytes, we can specify a minimum size when we view the heap to limit to these large objects.</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; !dumpheap -mt 0x02af36dc -min 85000&nbsp;-stat <br /> Using our cache to search the heap. <br />&nbsp;&nbsp; Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MT&nbsp;&nbsp;&nbsp;&nbsp; Size&nbsp; Gen <br /> Statistics: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MT&nbsp;&nbsp;&nbsp; Count&nbsp;&nbsp;&nbsp; TotalSize Class Name <br /> 0x02af36dc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 139&nbsp; 305,074,736 System.Byte[] <br /><strong>Total 139 objects, Total size: 305,074,736</strong></p>
</div>
<p>This shows us we have 139 Byte Arrays in the large object heap that account for 290.94 MB of our managed space.&nbsp; Since there were over 11 thousand byte arrays total and all together they accounted for 298 MB, it&rsquo;s fair to say the LoH Byte Arrays should be the focus of our investigation.&nbsp; Our next step then is to dump out the Byte Arrays and begin looking to see what they are and if they&rsquo;re still rooted.</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; !dumpheap -mt 0x02af36dc -min 85000&nbsp;<br /> Using our cache to search the heap. <br />&nbsp;&nbsp; Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MT&nbsp;&nbsp;&nbsp;&nbsp; Size&nbsp; Gen <br /> 0x202fb838 0x02af36dc 2,077,524 3 System.Byte[] <br /> 0x205dc320 0x02af36dc 3,704,228 3 System.Byte[] <br /> 0x209648d8 0x02af36dc 4,990,036 3 System.Byte[] <br /> 0x20e26d40 0x02af36dc&nbsp; 125,592 3 System.Byte[] <br /> 0x3b1f0038 0x02af36dc 3,449,224 3 System.Byte[] <br /> 0x3b53a1d0 0x02af36dc&nbsp; 109,140 3 System.Byte[] <br /> 0x3b554c38 0x02af36dc 2,625,400 3 System.Byte[]</p>
<p>&lt;snipped for brevity&gt;</p>
<p>&nbsp;</p>
</div>
<p>I ran !gcroot on several of the address listed, but did not find any roots.&nbsp; As it turns out, the dump I was looking at was taken on a terminate process breakpoint and many of the managed structures were already in the process of being torn down.&nbsp; Since we couldn&rsquo;t find any roots explaining why the Byte Arrays were still around, we have to look at the Arrays themselves to figure out what they are and hopefully tie them back to some source code.</p>
<p>A quick db on one of the Byte Arrays shows</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; db 0x202fb838 <br /> 202fb838&nbsp; dc 36 af 02 46 b3 1f 00-ff d8 ff e1 63 1d 45 78&nbsp; .6..F.......c.Ex <br /> 202fb848&nbsp; 69 66 00 00 4d 4d 00 2a-00 00 00 08 00 0a 01 0f&nbsp; if..MM.*........ <br /> 202fb858&nbsp; 00 02 00 00 00 16 00 00-01 b2 01 10 00 02 00 00&nbsp; ................ <br /> 202fb868&nbsp; 00 25 00 00 01 c8 01 12-00 03 00 00 00 01 00 01&nbsp; .%.............. <br /> 202fb878&nbsp; 00 00 01 1a 00 05 00 00-00 01 00 00 01 ee 01 1b&nbsp; ................ <br /> 202fb888&nbsp; 00 05 00 00 00 01 00 00-01 f6 01 28 00 03 00 00&nbsp; ...........(.... <br /> 202fb898&nbsp; 00 01 00 02 00 00 01 32-00 02 00 00 00 14 00 00&nbsp; .......2........ <br /> 202fb8a8&nbsp; 01 fe 02 13 00 03 00 00-00 01 00 01 00 00 47 46&nbsp; ..............GF</p>
</div>
<p>Most of what we see is unhelpful, but we see the string &ldquo;Exif&rdquo; suggesting this might be a digital photo.&nbsp; Dumping further into the array we see another interesting string:</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>202fb9f8 00 00 00 00 00 00 45 41 53 54 4d 41 4e 20 4b 4f&nbsp; ......EASTMAN KO <br /> 202fba08 44 41 4b 20 43 4f 4d 50 41 4e 59 00 4b 4f 44 41&nbsp; DAK COMPANY.KODA <br /> 202fba18 4b 20 45 41 53 59 53 48 41 52 45 20 56 31 30 37&nbsp; K EASYSHARE V107 <br /> 202fba28 33 20 44 49 47 49 54 41 4c 20 43 41 4d 45 52 41&nbsp; 3 DIGITAL CAMERA</p>
</div>
<p>That certainly supports the idea that we have a digital photo taken with a digital camera (a Kodak Easyshare to be precise).&nbsp; Checking a few of the other byte arrays, we can see the same pattern.</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; db 0x202fb838 <br /> 202fb838&nbsp; dc 36 af 02 46 b3 1f 00-ff d8 ff e1 63 1d 45 78&nbsp; .6..F.......c.Ex <br /> 202fb848&nbsp; 69 66 00 00 4d 4d 00 2a-00 00 00 08 00 0a 01 0f&nbsp; if..MM.*........ <br /> <br /> 0:000&gt; db 0x3c478e80 <br /> 3c478e80&nbsp; dc 36 af 02 1c c6 49 00-ff d8 ff e0 00 10 4a 46&nbsp; .6....I.......JF <br /> 3c478e90&nbsp; 49 46 00 01 01 01 00 60-00 60 00 00 ff e1 19 78&nbsp; IF.....`.`.....x <br /> 3c478ea0&nbsp; 45 78 69 66 00 00 49 49-2a 00 08 00 00 00 11 00&nbsp; Exif..II*....... <br /> <br /> 0:000&gt; db 0x3a1f0038 <br /> 3a1f0038&nbsp; dc 36 af 02 0a ff 32 00-ff d8 ff e0 00 10 4a 46&nbsp; .6....2.......JF <br /> 3a1f0048&nbsp; 49 46 00 01 01 01 00 48-00 48 00 00 ff e1 23 27&nbsp; IF.....H.H....#' <br /> 3a1f0058&nbsp; 45 78 69 66 00 00 49 49-2a 00 08 00 00 00 10 00&nbsp; Exif..II*.......</p>
</div>
<p>At this point, we&rsquo;ll assume they were all digital photos.&nbsp; We can revise that assumption if source review doesn&rsquo;t agree with us.&nbsp; At this point, we really need to look at the source to see why the pictures are staying around.&nbsp; I don&rsquo;t have the source available as this was given to me as a dump taken during shutdown, so exporting the modules didn&rsquo;t work.&nbsp; The only thing left to really get from the dump is the pictures themselves.&nbsp; All that&rsquo;s left to do is export a few of the byte arrays to disk so we can open them and maybe narrow down what we need to look at in the source (are these employee photos? a family outing? product photos?)</p>
<p>We&rsquo;ll use the writemem command in windbg and simply write the byte array from the address of the array plus 8 to avoid the metadata.</p>
<div style="text-align: left; font-size: 8pt; background-color: #c0c0c0;">
<p>0:000&gt; !do <strong><span style="color: #ff0000;">0x202fb838</span></strong> <br /> Name: System.Byte[] <br />MethodTable: 02af36dc <br />EEClass: 028aeb7c <br /> Size: 2077522(<strong><span style="color: #0000ff;">0x1fb352</span></strong>) bytes <br /> GC Generation: 3 <br /> Array: Rank 1, Number of elements 2077510, Type Byte <br /> Element Type: System.Byte <br /> Fields: <br /> None <br /> 0:000&gt; .writemem f:\output.jpg <strong><span style="color: #ff0000;">0x202fb838</span></strong>+8 L?<strong><span style="color: #0000ff;">0x1fb352</span></strong> <br /> Writing 1fb352 bytes........................................</p>
</div>
<p>Then we can open it up and view our result.&nbsp; I dumped several out, all of which were pictures of kids on what looked to be a field trip.&nbsp; That helped narrow down the user activity and focus the source review for the resolution.&nbsp; If the source code didn&rsquo;t provide a resolution, our next step would have been to take another dump when the memory was high but the process wasn&rsquo;t shutting down.&nbsp; This should have shown us how the Byte Arrays were rooted at which point we would have been able to handle them.</p>
<p>&nbsp;</p>
<p>In this case, I used the following command to export all of the pictures at once:</p>
<p><strong>.foreach (var {!dumpheap -mt 0x02af36dc -min 85000&nbsp;-short}) {.writemem f:\Pictures\${var}.jpg ${var}+8 L?poi(${var}+4)}</strong></p>
<p>&nbsp;</p>
<p>-Jarrod</p>]]></content:encoded>
    </item>
  </channel>
</rss>