Valgrind

Interface to determine, if an app is running with valgrind.
Valgrind is a unix tool to detect leaks and invalid memory access in an application.

File information

Filecommon/interface/valgrind.h

Classes IValgrind

Examples IValgrind::RunningOnValgrind
Starting an app with valgrind

Classes

IValgrind

class IValgrind {
public:
    static bool RunningOnValgrind();
};

Public functions

RunningOnValgrind (static function)
This function is used to determine, if the app has been started with valgrind.

Code Example

            if(IValgrind::RunningOnValgrind()) {
    // do something differently
}
            

Starting an app with valgrind

You can start valgrind with a lot of options. One option is to tell valgrind to generate XML output files (--xml=yes --xml-file=...).
In this case, the errors and warnings are written to the specified file, otherwise to the console.
There are some false positive leaks from valgrind and these are suppressed by a certain suppression file (/home/admin/valgrind-inno.supp).
Always make sure the executable binary has the executable flag set.

Shell Example

            chmod +x /apps/myapp/myapp
valgrind --track-origins=yes --suppressions=/home/admin/valgrind-inno.supp --trace-children=yes --trace-children-skip=/bin/\*,/sbin/\*,/usr/\*,/etc/\* --show-leak-kinds=all --leak-check=full --xml=yes --xml-file=/home/admin/valgrind-%p.xml /apps/myapp/myapp