Leaking memory not nice ;)

By | February 25, 2008

During the last weekend I was working on making the synch tool I wrote even better. Some people wrote me that it consumed a massive amount of memory. But only if they ran it without multithreading.

First thing I had to figure out is what version they were using. I had already fixed some minor memory issues in the directory scanner I build. So when I ran a similar setting as them I saw the memory usage increase to 120 MiB. To my horror when the program finished I got a memory dump from Visual Studio telling me that over 100 MiB memory was not properly released. Sigh :(.

Apparently I had a minor memory leak in the scheduling of new directories in the scanner. If it wasn’t ran with multi-threading I never released the object. But an even bigger memory leak was in my error reporting system. Which is part of the core technology used in all my applications.

The problem was actually simple. I had recently changed the content of one of the objects I create when logging. But I forgot that when you create an array and don’t throw it away you get a lot of leaked memory ;).

Down side of this is that I now have to rebuild every project using this library. Should only be half a day of work or so :D.

Leave a Reply