Category Archives: VC++

Accelerating Debug Runs, Part 2: _ITERATOR_DEBUG_LEVEL

A previous post discussed the Windows Debug Heap – with the main motivation being how to avoid it, as it is just empty, expensive overhead, and it isn’t clear why it is on by default in the first place. Remarkably, … Continue reading

Posted in Debugging, VC++ | 1 Comment

Debugging Memory Corruption II

Some years ago I shared a trick that let’s you call _CrtCheckMemory from the debugger anywhere, without re-compilation.   The updated (as of VS2013) string to type at a watch window is: {,,msvcr120d.dll}_CrtCheckMemory() Let’s expand on that today, in two steps. … Continue reading

Posted in Debugging, VC++ | 3 Comments

UseDebugLibraries and Wrong Defaults for VC++ Project Properties

Many of the projects I’m working on seem to have wrong default properties in Debug configuration.  For example, ‘Runtime Library’ is explicitly set to /MDd but defaults to /MD. ‘Basic Runtime Checks’ is explicitly set to /RTC1 but defaults to  … Continue reading

Posted in MSBuild, VC++ | 2 Comments

Vector Deleting Destructor and Weak Linkage

Now that the discussions on weak linker symbols and vector deleting destructors are in place, it is time to discuss a fact that might seem esoteric but has far reaching implications. After that, it is time to ask for your … Continue reading

Posted in VC++ | 9 Comments

Executing Code Once Per Thread in an OpenMP Loop

Take this toy loop: Now suppose you want to run some preparation code once per thread – say, SetThreadName, or SetThreadPriority or whatnot.  How would you go about that? If you code it before the loop the code would execute … Continue reading

Posted in C++, VC++ | 5 Comments

On Vector Deleting Destructors and some new/delete internals

A word is due on vector deleting destructors – previously mentioned as the only functions that got weakly bound by the linker. The usual disclaimers apply: everything that follows is my own investigation, in code and online. Nothing here is … Continue reading

Posted in VC++ | 4 Comments

Setting a Watch on Wide Registers in VS

General-purpose registers can be watched from the watch window pretty much as regular variables: (the ‘$’ prefix is optional, but is recommended by MS – probably as means to minimize clashes with code variables.) It is less known that you … Continue reading

Posted in Debugging, VC++ | Leave a comment