build: +OPENCV_ENABLE_MEMORY_SANITIZER flag

pull/14394/head
Alexander Alekhin 6 years ago
parent 8eb685de9d
commit c1981f28ad
  1. 1
      CMakeLists.txt
  2. 3
      cmake/OpenCVCompilerOptions.cmake
  3. 4
      modules/core/include/opencv2/core/utility.hpp

@ -470,6 +470,7 @@ OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC )
OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CV_GCC )
OCV_OPTION(OPENCV_ENABLE_MEMORY_SANITIZER "Better support for memory/address sanitizers" OFF)
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CV_GCC )
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CV_GCC AND (X86 OR X86_64)) )

@ -381,4 +381,7 @@ macro(ocv_add_modules_compiler_options)
string(REPLACE "/W3" "/W4" ${flags} "${${flags}}")
endforeach()
endif()
if(OPENCV_ENABLE_MEMORY_SANITIZER)
add_definitions(-DOPENCV_ENABLE_MEMORY_SANITIZER=1)
endif()
endmacro()

@ -116,7 +116,11 @@ CV_EXPORTS void setUseCollection(bool flag); // set implementation collection st
}
\endcode
*/
#ifdef OPENCV_ENABLE_MEMORY_SANITIZER
template<typename _Tp, size_t fixed_size = 0> class AutoBuffer
#else
template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class AutoBuffer
#endif
{
public:
typedef _Tp value_type;

Loading…
Cancel
Save