# Combine sanitizer check in one single MemCheck analysis

**URL:** https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658
**Category:** Usage
**Tags:** tool:ctest
**Created:** [May 20, 2026, 9:33am UTC](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658 "2026-05-20T09:33:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![npoletz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/n/b5ac83/32.png) [@npoletz](https://discourse.cmake.org/u/npoletz)
#### Post date: [May 20, 2026, 9:33am UTC](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658/1 "2026-05-20T09:33:36Z")

</div>

I am currently testing the dynamic analysis with `UndefinedBehaviorSanitizer` and `AddressSanitizer`.  
It works well separately and defects are correctly reported on our dashboard.

However I am wondering if there is a way to combine both analysis to avoid running twice my project test database.

Any guidance would be much appreciated. Thanks!

---

<div class="post-metadata">

### Author: ![sjoubert](https://discourse.cmake.org/user_avatar/discourse.cmake.org/sjoubert/32/110_2.png) [@sjoubert](https://discourse.cmake.org/u/sjoubert)
#### Post date: [May 20, 2026, 9:43am UTC](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658/2 "2026-05-20T09:43:59Z")

</div>

Setup both analyzers flags in your build (e.g. `-fsanitize=address,undefined`) instead of only one.

You’ll only be able to set `CTEST_MEMORYCHECK_TYPE` to one of them though. That’s the only thing I’m not totally sure it works correctly, if cmake/ctest/cdash does things specifically based on the check type you might only get one set of results.

---

<div class="post-metadata">

### Author: ![sjoubert](https://discourse.cmake.org/user_avatar/discourse.cmake.org/sjoubert/32/110_2.png) [@sjoubert](https://discourse.cmake.org/u/sjoubert)
#### Post date: [May 20, 2026, 9:52am UTC](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658/3 "2026-05-20T09:52:47Z")

</div>

Yeah, from the [MemoryChecker code](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/CTest/cmCTestMemCheckHandler.cxx?ref_type=heads#L730-835) it seems that both the output file and it’s regex parsing are specific to the configured check type, so for now we can only get one sanitizer report at a time 😕

---

<div class="post-metadata">

### Author: ![npoletz](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/n/b5ac83/32.png) [@npoletz](https://discourse.cmake.org/u/npoletz)
#### Post date: [July 8, 2026, 3:44pm UTC](https://discourse.cmake.org/t/combine-sanitizer-check-in-one-single-memcheck-analysis/15658/4 "2026-07-08T15:44:34Z")

</div>

It makes sense as sanitize (`ASAN`, `TSAN`, `MSAN` and `UBSAN`) should generally be run separately, except that `ASAN` and `UBSAN` can be combined safely.
