From cd552e1bdad6bb57da0acb13d76dc7ecb4d0be20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 29 Oct 2021 15:19:13 +0200 Subject: [PATCH] Add build.py option for disabling memleak checker The memleak checker used by default in Debug configuration does not play nice with embedding static lib of ONNXRuntime into binaries, because other code will not be using the same debug heap, leading to trouble. This makes it easier for outside builders to disable it for their build. --- tools/ci_build/build.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index acbeb54aaa..8ef9038e19 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -341,6 +341,9 @@ def parse_arguments(): help="Specify the minimum version of the target platform " "(e.g. macOS or iOS)" "This is only supported on MacOS") + parser.add_argument( + "--disable_memleak_checker", action='store_true', + help="Disable memory leak checker from Windows build") # WebAssembly build parser.add_argument("--build_wasm", action='store_true', help="Build for WebAssembly") @@ -1120,7 +1123,8 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home, cudnn_home "-Donnxruntime_ENABLE_MEMLEAK_CHECKER=" + ("ON" if config.lower() == 'debug' and not args.use_nuphar and not args.use_openvino and not - args.enable_msvc_static_runtime + args.enable_msvc_static_runtime and not + args.disable_memleak_checker else "OFF"), "-DCMAKE_BUILD_TYPE={}".format(config)], cwd=config_build_dir)