-
Notifications
You must be signed in to change notification settings - Fork 1
Getting_Started
Simply clone the repo and add the scripts directory to your PATH:
cd <dir>
git clone https://github.com/nyfix/memleaktest.git
export PATH=<dir>/memleaktest/scripts:${PATH}
-
One of the beauties of valgrind is that it works with any executable and any compiler -- no special build options are required, it "just works".
-
By contrast, AddressSanitizer instruments the code at build time to insert checking code. To enable AddressSanitizer, include the following flags at compile and link time:
-fsanitize=address -fsanitize-address-use-after-scope -
With either tool, certain build settings can affect the ability of the tools to detect errors. In particular,
-fno-omit-frame-pointercan result in more accurate stack traces.
-
With valgrind, you run your executables under valgrind's control, like so:
valgrind <executable_name> <parameters> -
With ASAN, you typically run the executable directly. (If you are using ASAN in "DSO" mode, you would also prefix the executable name with the appropriate
LD_PRELOAD=setting).
In either case, there are a number of runtime options that can (and should) be set. The simplest way to do that is to use the appropriate enviroment variable (either VALGRIND_OPTS or ASAN_OPTIONS, respectively). The options that we've found to be useful are listed on the run-time options page.
As mentioned elsewhere, the basic approach for using the scripts is to run the tool (either valgrind or AddressSanitizer) and capture as much data as possible to file(s) -- the scripts can then be used to filter and suppress reports after the fact.
So, with valgrind for example we typically enable all leak types (direct, indirect, possibly lost and still-reachable), and use the scripts to filter the relevant types in or out.
If you've followed the recommendations under run-time options, you'll have all the report files in a single directory. This makes it easy to process all the report files at one time -- e.g., for valgrind:
$ cd ${VALGRIND_LOGDIR}
$ vlc.sh valgrind*.out > vlc.out
Copyright 2019 Itiviti AB. Licensed under the Apache License, version 2.0.