Saturday, August 30, 2014

Memory Testing Issues

The next step is to start using C++ smart pointers (described in the next post).  One use for smart pointers will be to replace the complicated code used to track the handling of tokens and the reporting of various errors (for example, memory leaks for tokens not freed).  Smart pointers will make this code unnecessary.  Before starting I thought it was a good idea to make sure the memory test scripts still worked.

There were no memory errors reported when using Qt 4.8.1 (installed with Mint13 or Ubuntu 12.04) or Qt 4.8.2 (installed with the kubuntu backports to get the latest KDE).  However, when building the application with Qt 4.8.6 (the latest Qt 4.8 that was installed from source), memory errors were reported.  The CMake build file was set up to generate the error suppression file from a template using the detected version and directory of Qt.  This file was not tested with newer versions of Qt.

It appeared that with Qt 4.8.6, memory errors were reported differently (which was also the case with Qt 4.8.4, also built from source).  After examining the output for each version of Qt, a common error suppressions file template was created that works with each of these four versions of Qt (other versions were not tested).

As with GDB, valgrind (the memory testing utility) only supports the new debug symbols output from GCC 4.8.1 starting with version 3.8.0 (3.7.0 is installed in Mint13).  Version 3.9.0 is the latest available from source code.  However, version 3.7.0 appears to work fine, including within Qt Creator.  The new errors suppressions file also works with valgrind 3.9.0.  Click Continue... for details on installing 3.9.0 from source, but this shouldn't be necessary on Mint 13 (Unbuntu 12.04).  The valgrind 3.10.0.SVN installed on Mint 17 (Ubuntu 14.04) reports errors differently and does not work with this error suppression file (for now 3.9.0 would have to be installed from source).

[branch cpp11 commit a2069aae24]