From 3c7253193e47640cc6261a3d54ba4615a378d294 Mon Sep 17 00:00:00 2001 From: Yury Bayda Date: Sun, 23 Aug 2026 12:22:15 -0700 Subject: [PATCH 1/2] docs: document allocator override scope Record why no preset or CMake option selects mimalloc, jemalloc, or tcmalloc: ASan's malloc interceptors, the per-platform override mechanism, and dependency binaries that come from the Conan cache unrebuilt. Point at the existing optional-tool pattern in the recipe for anyone adding one. --- docs/development.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/development.md b/docs/development.md index df984b6..983c273 100644 --- a/docs/development.md +++ b/docs/development.md @@ -170,6 +170,28 @@ where glibc fortification warns. The other hardening flags stay on. Like the war hardening covers first-party code only; dependency binaries from the Conan cache are not rebuilt with these flags. +### Allocators + +This template does not replace the system allocator, and no preset or CMake option selects +[mimalloc](https://github.com/microsoft/mimalloc), [jemalloc](https://github.com/jemalloc/jemalloc), +or [tcmalloc](https://github.com/google/tcmalloc). An allocator is chosen against a measured +allocation profile, which a boilerplate does not have. Three constraints make it more than a +link-line change here: + +- ASan installs its own `malloc`/`free` interceptors. An override linked on top of them either fails + to link or leaves the heap diagnostics silently disabled, so every `sanitize*` preset would have + to gate the allocator off. +- The override mechanism is per platform. mimalloc's static override works on Linux; macOS needs + runtime interposition through `DYLD_INSERT_LIBRARIES`; Windows needs `mimalloc-redirect.dll` + beside the executable, which the `install(TARGETS)` rule does not ship. +- The override is process-wide, but dependency binaries come from the Conan cache and are not + rebuilt. Any measurement has to cover the whole process, not the first-party targets alone. + +To add one, follow the path the recipe already uses for optional tools: declare a Conan option in +[`conanfile.py`](../conanfile.py), add the requirement under `requirements()`, forward the choice to +CMake through `tc.cache_variables` next to the `ccache` and `mold`/LLD probes in `generate()`, and +fail configuration when `compiler.sanitizer` is set. Rerun `make lock` afterwards. + ## IDE setup ### VS Code From 77332edacdcd4804b92528bda0134b43e3915ee2 Mon Sep 17 00:00:00 2001 From: Yury Bayda Date: Sun, 23 Aug 2026 12:25:50 -0700 Subject: [PATCH 2/2] docs: scope the allocator sanitizer gate to ASan UBSan does not intercept malloc, so sanitize-ubsan can run an allocator override. Name the Address and AddressUndefinedBehavior settings instead of every sanitize* preset. --- docs/development.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/development.md b/docs/development.md index 983c273..9561ee6 100644 --- a/docs/development.md +++ b/docs/development.md @@ -179,8 +179,9 @@ allocation profile, which a boilerplate does not have. Three constraints make it link-line change here: - ASan installs its own `malloc`/`free` interceptors. An override linked on top of them either fails - to link or leaves the heap diagnostics silently disabled, so every `sanitize*` preset would have - to gate the allocator off. + to link or leaves the heap diagnostics silently disabled, so the `sanitize` and `sanitize-asan` + presets would have to gate the allocator off. UBSan does not replace the allocator, so + `sanitize-ubsan` can keep it. - The override mechanism is per platform. mimalloc's static override works on Linux; macOS needs runtime interposition through `DYLD_INSERT_LIBRARIES`; Windows needs `mimalloc-redirect.dll` beside the executable, which the `install(TARGETS)` rule does not ship. @@ -190,7 +191,8 @@ link-line change here: To add one, follow the path the recipe already uses for optional tools: declare a Conan option in [`conanfile.py`](../conanfile.py), add the requirement under `requirements()`, forward the choice to CMake through `tc.cache_variables` next to the `ccache` and `mold`/LLD probes in `generate()`, and -fail configuration when `compiler.sanitizer` is set. Rerun `make lock` afterwards. +fail configuration when `compiler.sanitizer` is `Address` or `AddressUndefinedBehavior`. Rerun +`make lock` afterwards. ## IDE setup