In the previous post I introduced some of the common cases for avoiding memory leaks with judicious use of unique_ptr. Of course, not all memory management situations are as straightforward, especially when dealing with low-level “C-style” APIs. Let’s explore a…
Avoid memory leaks by design
There are many tools and techniques out there to help detect memory leaks. For instance, you can monitor performance counters for unexpected memory growth. Once a leak is suspected, UMDH might be able to help you pinpoint the culprit. However,…
Native InputQueue thread-safety
In the previous post, I introduced my port of InputQueue to C++. As usual, the unit tests drove the creation of a correct single-threaded implementation but slightly more needed to be done to make the code thread-safe. The go-to construct…
Porting InputQueue to C++
In the previous post, I gave a brief intro to the PPL and the basic constructs for writing async C++ code. In this post, I will discuss the highlights of how I ported the InputQueue sample to C++ using the…
Async in C++ with the PPL
The Parallel Patterns Library (PPL) provides C++ developers with some very useful concurrency primitives along similar lines as Task parallelism in .NET. Having been introduced in Visual Studio 2010, the PPL is not new by any means. However, it remains…
Testing down low
In the last post, I discussed high-level testing of a simple distributed service. Now let’s look at the bottom of the stack. What are good candidates for testing at this level? To name a few: Basic functional/algorithmic correctness Unit/module cohesion…
Testing from up high
In the previous post, I introduced a simple distributed service and some considerations that might drive a test planning effort. In this initial drill down, I will take a look at the tradeoffs of testing this system “from up high”…
Testing at the right level
A large-scale distributed service is deployed to a datacenter across hundreds of machines. The basic topology is as follows: Consider the following scenarios and requirements: The service should respond with an error if a client requests a nonexistent resource. The…
InputQueue use cases
In my previous post, I introduced InputQueue. Now for some (hopefully) realistic examples of how you can use it. Perhaps the most obvious scenario is a command processor with an async dispatch loop, for example: This processor allows a single…
InputQueue, the non-BlockingCollection
The .NET 4.0+ solution to the producer-consumer problem is BlockingCollection. A sample app with a single producer and consumer using an ordered queue of integers would look something like this: This is simple enough, but the problem is that DequeueLoop.…