More on MiniDumper: Getting the Right Memory Pages for .NET Analysis

September 30, 2015

In my previous post on MiniDumper, I promised to explain in more detail how it figures out which memory ranges are required for .NET heap analysis. This is an interesting story, actually, because I tried a couple of approaches that failed before coming up with the final idea. Basically, I knew that a dump with full memory contains way more information than is necessary for .NET dump analysis. Even if you need the entire .NET heap available, you typically don't need a bunch of other memory ranges: executable code, Win32 heaps, unused regions of thread stacks, and so much more. My...
no comments

Materials from TechDays Netherlands 2015

August 31, 2015

Oops! This was sitting in my queue for several months now, and I just noticed it needs to be published. But better late than never I guess. Here goes: I've been lucky enough to be invited to speak at TechDays Netherlands again this year. This time I was asked to do four talks on some of my favorite subjects -- performance optimization, debugging, and diagnostics. Same as last year, the conference was impeccably organized. I'm really looking forward to next year's TechDays :-) In the meantime, here are the materials from my talks. Making .NET Applications Faster My usual favorite on improving...

Creating Smaller, But Still Usable, Dumps of .NET Applications

August 19, 2015

MiniDumper is born. It is an open source library and command-line tool that can generate dump files of .NET processes. However, unlike standard tools such as Procdump, MiniDumper has three modes of operation: Full memory dumps (analogous to Procdump's -ma option). This is a complete dump of the process' memory, which includes the CLR heap but also a bunch of unnecessary information if you're mostly working with .NET applications. For example, a full memory dump will contain the binary code for all loaded modules, the unmanaged heap data, and a lot more. Heap-only dumps (no Procdump analog). This is a dump that contains the...

A Neat Stack Corruption, or Reverse P/Invoke Structure Packing with Output Parameters

August 18, 2015

I know, I'm working hard on beating my record for longest post title ever. I also thought of adding a random Win32 API to the title, say CoMarshalInterThreadInterfaceInStream or AccessCheckByTypeResultListAndAuditAlarmByHandle. But I didn't, so here we are. What was I saying? Oh yeah, a neat stack corruption I spent a couple of hours chasing last week. I was doing my usual reverse P/Invoke where I call a Windows API and pass a delegate as a callback. There's a bunch of APIs in Win32 that take callbacks, but for the sake of this post let's take a look at a very simple example...

Why You Have to Learn Modern C++

August 15, 2015

The C++ language many of us are using today goes back more than thirty years. You might be using some “newer” features, such as templates or the standard library, which have been standardized around 1998 – the previous millennium. Since 1998, C++ has seen two major international standards – C++ 11 and C++ 14, and work is in progress on another major revision to be published in 2017. Over the last few years, C++ developers all over the world are transitioning to the new, modern C++. It’s not just a matter of language features or library APIs. It’s a matter...
tags: , ,

PSA: Add noexcept When Migrating to Visual C++ 2015

July 30, 2015

tl;dr -- when migrating from Visual C++ 2013 to Visual C++ 2015, make sure that (1) your destructors do not throw exceptions, and (2) your move constructors are marked noexcept if they do not throw exceptions. Less than a year ago, I described some of the reasons why noexcept is an important C++ language feature that lurks in the background and waits for the right moment to bite you in the neck. Specifically, destructors and move constructors should ideally be marked as noexcept. For move constructors, this "ideally" means there are corner cases where performance won't be optimal if you don't mark the move constructor noexcept; for destructors,...
no comments

Materials from NDC Oslo 2015

July 16, 2015

It was my first time at NDC Oslo, and my first time in Norway as well. I was really impressed with the city of Oslo, with the conference venue, with the energy that could be felt all around the halls and expos, and with the great hospitality of the conference organizers. I'm really looking forward to be back at NDC London or NDC Oslo (and who knows, maybe NDC Australia too?). In the meantime, here are the materials from my two talks, both of which were recorded and are already available online to watch. Swift: Apple's New Programming Language for iOS and...
no comments

Obtaining the CoreCLR DAC DLL for Windows Phone

July 6, 2015

Three years ago I blogged about obtaining SOS.dll and mscordacwks.dll indirectly from the Microsoft KB websites in case you only have a dump from the production system but can't gain access to copy these files over. (Reminder: SOS.dll is a WinDbg extension for debugging .NET processes and dump files. The DAC, or mscordacwks.dll, is a helper library used by SOS to access the inner workings of a specific CLR version's data structures. The DAC is also used by ClrMD, a managed library that provides an API replacement for the SOS extension commands.) It turns out that for Windows Phone applications (using the Windows Phone...

Defensive Programming Gone Too Far, Or Respecting Your Contracts

June 30, 2015

In the last few months, I've heard this argument more than once. And whenever I have to repeat my counter-arguments, I know it is time for a blog post. So here goes, a short take on defensive programming gone too far. Suppose you have the following, extremely boring, C++ function (the language is not of any importance for this exercise): bool add_task(employee& emp, task const& t) { if (emp.task_count() > 10) return false; emp.add_task(t); return true; } And here's the argument I'm going to be fighting against until I draw my last breath: The function needs to be more...

Materials From This Year’s First SDP

June 5, 2015

Another SDP conference is behind us! It's been an incredible week of brand new technology talks, meeting customers, jogging across the Tel-Aviv beach, and also getting a pretty bad cold from the air conditioning at the conference hotel. We are already hard at work planning the next conference, but in the meantime, here are the materials from my talks this year. Elements of Modern C++ Style This talk, based on materials from our Modern C++ course, introduced four key tenets which I believe are fundamental to modern C++ code: letting the compiler help you out (with language features like auto and...
tags: ,
no comments