Tips for debugging with Valgrind
Some earlier Valgrind versions did not support AVX properly and will crash in some Carbonite code. This issue doesn’t occur in newer Valgrind versions, such as 3.16.0.
It is recommended to increase the backtrace size using
--num-callers=<number>
. Valgrind’s default backtrace depth is 12, which is often not sufficient for Carbonite code.When checking for memory leaks with
--leak-check=full
, you may notice a large number of ‘possibly lost’ leaks (particularly from libasound). Use--show-leak-kinds=definite
to only see detections that are guaranteed to be memory leaks.When Carbonite plugins are unloaded, Valgrind will not be able to find the symbol names for functions in its backtraces that were part of the unloaded code. This can be a problem when trying to detect memory leaks in tests. Putting
exit(0)
at the end of a test case is generally sufficient as a workaround.Valgrind executes programs serially and uses an unfair thread scheduling algorithm, which can cause threads to appear to hang. The
--fair-sched=yes
parameter can be used to switch to a fair scheduler which will avoid these hangs. This parameter must be specified when using any code that interacts with IAudioPlayback.If you build Valgrind from source and install to a non-system directory (such as your home folder), the environment variable
VALGRIND_LIB
needs to point to thelib/valgrind
directory in the install directory.