{"id":1903,"date":"2014-02-06T16:02:00","date_gmt":"2014-02-06T16:02:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2014\/02\/06\/net-memory-analysis-object-inspection\/"},"modified":"2022-07-18T05:52:20","modified_gmt":"2022-07-18T13:52:20","slug":"net-memory-analysis-object-inspection","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/net-memory-analysis-object-inspection\/","title":{"rendered":".NET Memory Analysis: Object Inspection"},"content":{"rendered":"<p>In Visual Studio 2013, we introduced a way to <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/06\/20\/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production.aspx\">analyze .NET Memory with Visual Studio<\/a>. Now in the <a href=\"http:\/\/blogs.msdn.com\/b\/bharry\/archive\/2014\/02\/05\/vs-tfs-2013-2-update-2-ctp-released.aspx\">Update 2<\/a>, we\u2019ve added a new feature to inspect values of objects and instances to improve your diagnostic capabilities. You can follow along using the same code and dumps from the <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/06\/20\/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production.aspx#sample\">SampleLeak App<\/a> we had in the <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/06\/20\/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production.aspx\">previous walkthrough<\/a>.<\/p>\n<p><em>If you are using Managed GCDumps in DiagSession files from Application Insights for Azure (<a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/12\/20\/investigating-memory-leaks-in-azure-web-sites-with-visual-studio-2013.aspx\">like from this blog post<\/a>), you will not have heap to inspect Instances and Values. This feature requires dumps with heap to have the information required for object inspection.<\/em><\/p>\n<h3>Instance View<\/h3>\n<p>While on the type summary page, we no longer show a drop down expansion of instances in a type. Instead we pop an icon to enter the new instance view. You can enter this view by clicking the icon or pressing Enter.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/02\/0143.mma1_.png\" alt=\"\" border=\"0\" \/><\/p>\n<p>This opens up a new instance view for you to dig deeper into your dump. You can edit the default value shown (instead of just the Type) <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.diagnostics.debuggerdisplayattribute%28v=vs.110%29.aspx\">by adding a DebuggerDisplayAttribute to your code<\/a>. Hovering over items will pop a DataTip to inspect the values for those instances. You can expand down the objects to inspect the data in the subfields. If you want to dig deep down without a DataTip, you can enter into Quick Watch by pressing Enter with the entry selected or through the context menu.<\/p>\n<p>With this inspection, you can see that all the User entries contained the same Id (your cache isn&#8217;t working as expected and you&#8217;re creating duplicate entries) and that BinaryData is containing an excessively large bulk of the allocation of the User object.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/02\/1513.mma2_.png\" alt=\"\" border=\"0\" \/><\/p>\n<p>This also applies in the Paths to Root and Referenced Objects graph at the bottom.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2014\/02\/5672.mma3_.png\" alt=\"\" border=\"0\" \/><\/p>\n<p>To return to the previous type overview, you can either select Type from the breadcrumbs at the top or hit the Back button or your Backspace key.<\/p>\n<h3>In Closing<\/h3>\n<p>With the addition of these enhancements, we hope these new features will give you more insight to what\u2019s happening inside your .NET Memory dumps. If you wish to know more about .NET Memory Analysis in general, please <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/06\/20\/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production.aspx\">revisit our two previous blog entries on the subject<\/a>. If you have any questions or comments, please leave them in the comments below or in <a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/en-US\/vsdebug\/threads\">our MSDN forum<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Visual Studio 2013, we introduced a way to analyze .NET Memory with Visual Studio. Now in the Update 2, we\u2019ve added a new feature to inspect values of objects and instances to improve your diagnostic capabilities. You can follow along using the same code and dumps from the SampleLeak App we had in the [&hellip;]<\/p>\n","protected":false},"author":74,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,225],"tags":[],"class_list":["post-1903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-git"],"acf":[],"blog_post_summary":"<p>In Visual Studio 2013, we introduced a way to analyze .NET Memory with Visual Studio. Now in the Update 2, we\u2019ve added a new feature to inspect values of objects and instances to improve your diagnostic capabilities. You can follow along using the same code and dumps from the SampleLeak App we had in the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/1903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/74"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=1903"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/1903\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=1903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=1903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=1903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}