c++11

C++ memory leak without virtual destructor

In this post I will talk about detecting and debugging memory leaks in a C++11 program, Visual Studio’s built in heap profiler and Intel Parallel Studio 2019. And also the importance of virtual destructors when implementing derived subclasses.

Hello concepts

Some of the motivation behind concepts, is to be able to restrict template interfaces in an easy-to-use way. It is possible today using template meta programming and static_assert with C++03/C++11/C++14/C++17. However, the error messages are insanely detailed and it’s almost not possible to decipher them without a black belt in template programming. With any modern compiler, it’s usually 50-100 lines of errors for simple template mistakes.

How to stop a std::async task

Sadly, this is only an intrusive way of stopping std::async. For an almost non-intrusive way of stopping a thread, look at boost::thread.

Boost scoped_ptr vs unique_ptr

A unique_ptr is also known as std::unique_ptr. Before C++11 it was boost::unique_ptr, but became a part of STD library in C++11 and is now called std::unique_ptr.

Optimize sort algorithm – or how I managed to get a high performance gain

I was recently hired as a C++ guru and performance specialist at a fairly large software consultancy company (1000+ employees). This particular division turned out to be a special division. More on that later. They had some software, which was in dire need of some new set of eyes watching over the code. One should think software developers are quite ubiquitous at a place like that, and they are. However, being mainly a managed shop (C#, Java) the presence of C++ developers is simply stunning (</irony>).