How to use address sanitizer on Windows in UE5.5 Project?

Hello, I want to detects memory corruption bugs in my UE5.5 project’s c++ code on Windows.

[XmlConfigFile(Category = "BuildConfiguration", Name = "bEnableAddressSanitizer")]
[CommandLine("-EnableASan")]
public bool bEnableAddressSanitizer = true;

I modified above code to enable asan. But after compilation, crash on the initialization of a class static member variable, FPreAnimatedWidgetMaterialSwitcherStorage::StorageID.

Could anyone tell me how to use address sanitizer? Or another tools?

the same for me

The same issue occurred in the editor, but the game build performed as expected.

I read a post from Chris Erickson on building Editor ASAN (haven’t tried myself yet):

  1. Use monolithic build (modular builds seems to crash due to cyclic dependencies)
  2. Use Clang as compiler
  3. Reduce the final binary size
    a. -fsanitize-address-outline-instrumentation
    b. optimize for size

Which makes sense to me.