Joe Duffy has written an interesting piece over on “Generalities & Details: Adventures in the High-tech Underbelly” about problems with the CLR thread pool. Joe’s a program manager on the CLR team at Microsoft, so he knows what he’s talking about!
I find the issues that Joe raises interesting as I spent some time designing a flexible thread pool for my C++ IOCP servers some time go and came across the problems that he’s facing.
Jeremy D. Miller talks about how he dislikes the “I” prefix on interface names and how he’d prefer to ditch it in the same way he’s ditched most other hungarian notation. I’m all for ditching hungarian but I actually quite like the “I” prefix; though I no longer read it as “this is an interface” but simply “this is what I do”. In other words my interfaces, called things like IManageUsers simply clearly state what they do, classes that implement the interface manage users; the class definition is saying “I Manage Users”!
Typical. My usual subject matter isn’t interesting enough to get onto digg.com, etc. but a throw-away post about using Ethereal to catch my partner cheating gets on the front page…
Ah well, such is life :) I’ll just try and write more interesting technical postings and in the mean time appreciate the kind words, the linky goodness, the traffic spike and correspondingly increased adsense revenue…
Well, it turns out that my initial gut instinct about the leaks that I found in my socket servers when built with VS 2005 was correct. It was an STL thing.
The following code reproduces the problem.
#include <strstream> #include <sstream> #include <iostream> #include <stdio.h> using std::strstream; using std::ostrstream; using std::stringstream; using std::ostringstream; using std::cout; using std::endl; int main(int argc, char* argv[]) { cout << "Ready - press a key to test strsteam" << endl; getchar(); const size_t loopCount = 100000; size_t i; for (i = 0; i < loopCount; ++i) { strstream buf; } cout << "Ready - press a key to test ostrsteam" << endl; getchar(); for (i = 0; i < loopCount; ++i) { ostrstream buf; } cout << "Ready - press a key to test stringsteam" << endl; getchar(); for (i = 0; i < loopCount; ++i) { stringstream buf; } cout << "Ready - press a key to test ostringsteam" << endl; getchar(); for (i = 0; i < loopCount; ++i) { ostringstream buf; } cout << "Done - press a key" << endl; getchar(); return 0; } The code and projects for VC6 through VS2005 can be downloaded from here.
Recently I’ve been getting lots of emails from people who seem to think that my company, JetByte Limited, is currently recruiting. We’re not now and are unlikely to be in the near future, but that doesn’t mean people shouldn’t send speculative emails. In the past I’ve always responded to each of the applicants, explained that we’re not recruiting, and sometimes even made suggestions on how they might improve their approach and/or resume/cv.
Once again I have a list of items flagged for comment in Bloglines but at least this time I have an excuse: “We were on a break!”.
First is a link from Brad Wilson to where Bruce Eckel writes about how the “Hyper enthusiasts” of the Java world have moved on to Ruby. Bruce makes some good points. Personally I’d be pretty happy if all persuasuion of “hyper enthusiast” were to vanish overnight, IMHO they just get in the way, distort the picture and encourage bad decisions…
Noel Llopis, over at Games From Within, has written a nice piece about a typical workday at his work place, High Moon Studios.
It certainly sounds like a nice way of working. Unfortunately I haven’t been involved in quite that agile a team yet.
It seems that the leak that I found isn’t likely to be the one that my new user of the code is having problems with. They’ve built the code with Visual Studio 2005, made a few (correct) changes to the code to get it to build with the stricter compiler and they find that several of the servers leak; at first it looked like it was just the more complex servers but I’ve just tested the simplest echo server and that leaks in just the same way.
Well, the leak in my legacy code wasn’t too hard to find. There was one potential leak and one screamingly obvious leak. I’ll post the fixed code tomorrow.
Paul Graham writes about “How to do what you love”… It’s quite a good piece but the best bit is hidden down near the end. He suggests that a good way to “stay honest with yourself” about dreams to do something other than your “day job” is to Always Produce; that is, don’t just talk about it or think about it, produce physical artefacts.
This is excellent advice and it can be applied to pretty much everything you do.