Home

LSANOPTIONS

LSANOPTIONS is commonly recognized as an environment variable used to configure LeakSanitizer, the leak-detection component of the LLVM sanitizers suite. The canonical variable name is LSAN_OPTIONS, and LSANOPTIONS (without the underscore) is sometimes encountered in documentation, scripts, or misuse, but programs that rely on LeakSanitizer typically read LSAN_OPTIONS. The variable enables fine-grained control over leak detection behavior and reporting without requiring recompilation.

The variable contains a colon-separated list of key=value options that the LeakSanitizer runtime interprets at startup.

Examples: exporting LSAN_OPTIONS="verbosity=1:leak_check_at_exit=1" will increase diagnostic output and perform a leak check when the program exits.

Notes: LSAN_OPTIONS primarily applies to C and C++ programs built with Clang/LLVM sanitizers. It may be ignored

Options
influence
what
leaks
are
detected,
how
much
detail
is
reported,
and
when
checks
are
performed.
Typical
options
include
enabling
or
disabling
leak
detection,
turning
on
origin
tracking
to
identify
where
a
leaked
allocation
originated,
controlling
the
level
of
verbosity,
and
directing
where
logs
are
written.
Many
installations
also
support
suppressions
files,
leak-check-at-exit
flags,
limits
on
reported
leaks,
and
log
paths.
Because
the
exact
set
of
options
can
vary
by
version,
it
is
common
to
consult
the
specific
toolchain’s
documentation
for
the
precise
keys
available.
Another
example
sets
a
log
path
with
LSAN_OPTIONS="log_path=/tmp/lsan.log:verbosity=2".
These
configurations
apply
to
programs
instrumented
with
LeakSanitizer
and
executed
in
environments
that
support
the
sanitizer.
on
non-instrumented
builds
or
with
other
toolchains.
For
broader
behavior,
LSAN_OPTIONS
is
often
used
in
combination
with
ASAN_OPTIONS
or
other
sanitizer
controls.