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.
I’m currently investigating a memory leak in a complicated piece of multi-threaded code. Unfortunately the code doesn’t have any unit tests and the leak only shows up reliably in the release build. Worse, I wrote the code and nobody has fiddled with it since, so it’s my leak and my code and I have nobody to complain about and no excuses. I miss the unit tests and loose coupling that would be present if I hadn’t written this particular piece of code quite so long ago.
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.
Charles Petzold confesses his love for books.
I must admit this bit really hit home for me: “I love how my books remind me of passages in my life. I love the shelves of authors I’ve been obsessed with, and the books that knocked me over. I love knowing that I still own virtually every book I’ve read.”
I have shelves and shelves of technical books as I’ve always been quite happy to buy a book on the chance that I might learn one thing from it.
I finally got around to upgrading my mobile phone from an aging Sony Ericsson T68i to a more current (though still hardly bleeding edge) Motorola Razr V3. I’m not interested in the downloadable java games but the fact that you can get a J2ME SDK for it and that the docs seem to imply that you can access the GPRS network using SSL and that you can also access the serial port makes it interesting… Now I just need a hack to be able to somehow connect the Garmin GPS to the V3 and some code to grab the location from the GPS and send it off to a web service somewhere and some duct tape to make it one device…
The size of the “units” that I test with my unit tests varies quite considerably. Usually I tend to work at the single class level; the test will provide mocks for the services that the class requires and the tests will ensure that the class behaves correctly and interacts as expected with the its service providers. Sometimes though the units consist of a whole subsystem, still often a single class, but one which wires up and collects many other classes into a single component; again the service providers that it uses may be mocked but they’re often only right on the edge of the functionality that is being tested.
Last week I managed to get my GPS code to download the GPS “track” from my device and create an html file that uses the Google Maps API to display it as an overlay.
I spent some time trying to get the map to display correctly from within the normal blog pages but something was causing Internet Explorer to fail to display the tracks. Firefox and Opera were fine; I guess it’s something to do with IE using VRML to display the track and the others using a server-side generated graphical overlay.
I’ve been plugging away at my multi-process Win32 debugger code this week and one of my test harnesses had started to suffer from intermittent “R6025 - pure virtual function call” errors. These tend to crop up if you call a virtual function from a constructor or destructor or if there’s a race condition between calling a method on an object from one thread and destroying the object in another thread. For me, at least, they tend to be simple mistakes to fix once I know where the problem lies.
Once again I’ve been too busy to comment on the following blog postings in a timely manner so here’s a collection of stuff that’s been sitting in my “good stuff” list for a while now.
Josh Carter over at “multipart-mixed” warns us of “The Perils of Bad C/C++” Schools. I must admit that I agree with him here, far too many programmers that I’ve dealt with over the years don’t really understand pointers even though you would think, from their background, that they should.
Jeremy D. Miller points out that my ‘second’ style of coding (see here) is called writing a “spike” in XP terms.