Add tooling for running under Valgrind.
[supertux.git] / tools / valgrind / README
1 You can use this script and suppressions file to run SuperTux under Valgrind
2 ( http://www.valgrind.org/ ) to catch memory errors and leaks.
3
4 Some things to be aware of:
5
6 - Some C++ objects appear to use interior pointers, which will cause valgrind to
7   report parts of their still-reachable instances as "possibly lost".  You can
8   ignore those reports.
9
10 - In the GNU C++ library, a std::string object contains a pointer to a
11   heap-allocated "representation" buffer containing the actual data.  If you
12   free a heap-allocated std::string S without destructing it (uncommon but not
13   unheard of), you'll leak the representation.  But representations are shared
14   and copied on write, so if S was a copy of another string S', Valgrind will
15   blame the leak on the code that created S' because that was when the
16   representation was allocated.  (Valgrind doesn't know any better without
17   instrumenting constructors and destructors.)  Watch out for this.  When it
18   first happened to me (Matt McCutchen), I was stumped for a while; finally,
19   I wrote some small test programs and realized what was happening.