@@ -348,6 +348,11 @@ cmake_dependent_option(
348348cmake_dependent_option(
349349 BUILD_FUNCTORCH "Build Functorch" ON "BUILD_PYTHON" OFF )
350350
351+ option (USE_MIMALLOC "Use mimalloc" OFF )
352+ # Enable third party mimalloc library to improve memory allocation performance on Windows.
353+ if (WIN32 )
354+ set (USE_MIMALLOC ON )
355+ endif ()
351356
352357if (USE_CCACHE)
353358 find_program (CCACHE_PROGRAM ccache)
@@ -817,6 +822,8 @@ if(NOT MSVC)
817822 append_cxx_flag_if_supported("-Wno-strict-aliasing" CMAKE_CXX_FLAGS )
818823 append_cxx_flag_if_supported("-Wvla-extension" CMAKE_CXX_FLAGS )
819824 append_cxx_flag_if_supported("-Wnewline-eof" CMAKE_CXX_FLAGS )
825+ append_cxx_flag_if_supported("-Winconsistent-missing-override" CMAKE_CXX_FLAGS )
826+ append_cxx_flag_if_supported("-Winconsistent-missing-destructor-override" CMAKE_CXX_FLAGS )
820827 if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang" )
821828 string (APPEND CMAKE_CXX_FLAGS " -Wno-range-loop-analysis" )
822829 string (APPEND CMAKE_CXX_FLAGS " -Wno-pass-failed" )
@@ -861,6 +868,8 @@ if(NOT MSVC)
861868
862869 append_cxx_flag_if_supported("-Wno-error=pedantic" CMAKE_CXX_FLAGS )
863870 append_cxx_flag_if_supported("-Wno-error=old-style-cast" CMAKE_CXX_FLAGS )
871+ append_cxx_flag_if_supported("-Wno-error=inconsistent-missing-override" CMAKE_CXX_FLAGS )
872+ append_cxx_flag_if_supported("-Wno-error=inconsistent-missing-destructor-override" CMAKE_CXX_FLAGS )
864873 append_cxx_flag_if_supported("-Wconstant-conversion" CMAKE_CXX_FLAGS )
865874 append_cxx_flag_if_supported("-Wno-invalid-partial-specialization" CMAKE_CXX_FLAGS )
866875 append_cxx_flag_if_supported("-Wno-unused-private-field" CMAKE_CXX_FLAGS )
@@ -1021,6 +1030,12 @@ include_directories(BEFORE ${PROJECT_BINARY_DIR})
10211030include_directories (BEFORE ${PROJECT_SOURCE_DIR} /aten/src/)
10221031include_directories (BEFORE ${PROJECT_BINARY_DIR} /aten/src/)
10231032
1033+ if (USE_MIMALLOC)
1034+ add_definitions (-DUSE_MIMALLOC)
1035+ add_subdirectory (third_party/mimalloc)
1036+ include_directories (third_party/mimalloc/include )
1037+ endif ()
1038+
10241039# ---[ Main build
10251040add_subdirectory (c10)
10261041add_subdirectory (caffe2)
0 commit comments