Deleaker for C++ Builder

Context

Previously, comparing C++Builder classic and Clang compilers I regreted than CodeGuard tool doesn't work with Clang. Fortunately, there are other tools which can help you to profile program code and detect memory leaks. The Dataleaker is the one of these tools.

Installation

The installation requires local administrator rights but is simple, you just need to choose the corresponding IDE to integrate. You're not limited with only C++ Builder seeing that Delphi and C++/C# under Visual Studio are also supported.

After restarting the IDE, the Deleaker becomes available.

Testing

Well, let's create a new console application project to test the profiler. C++Builder project will use classic compiler by default, so you should change it in project options.

Here is my very small program to test memory leak

class A
{
public:
    A() { m_pInt = new int; }
private:
    int* m_pInt;
};
 
int _tmain(int argc, _TCHAR* argv[])
{
    A a;
    return 0;
}

When compiling and running this program, Deleaker tool shows the memory leaks found pointing to the exactly line of code.

Does it work with 64-bits compiler, too? Let's add the "Windows 64" platform to the project.


Now rebuild and re-run the program. Yes, Deleaker works as expected and shows us the same memory problem!

Other functions

Deleaker can be used as a standalone profiler out of IDE debugging. The corresponding case is testing of release binaries.

Deleaker has also a command-line utility DeleakerConsole.exe that can be integrated to delivery process, for example, to automate some kind of testing.

DeleakerConsole.exe --export-xml-report-on-exit MyReport.xml --crash-dump-directory D:\Projects\Dumps --run D:\Projects\MyApp\MyApp.exe /my_app_option

Pros and cons

Deleaker seems to be a functional tool but lightweight at same time. However, the commercial license may be discouraging in some cases. For example, for my pet projects I'd like to use a free version which can be limited functionally and/or by community edition of IDE.