Commit b46e741c authored by Alexander Alekhin's avatar Alexander Alekhin

core(alloc): drop unused code, use memalign() functions instead of hacks

valgrind provides better detection without memory buffer hacks
parent 34f9c039
......@@ -551,6 +551,7 @@ if(UNIX)
endif()
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckSymbolExists)
if(NOT APPLE)
CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)
......@@ -566,6 +567,12 @@ if(UNIX)
else()
set(HAVE_LIBPTHREAD YES)
endif()
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
if(HAVE_MALLOC_H)
CHECK_SYMBOL_EXISTS(memalign malloc.h HAVE_MEMALIGN)
endif()
endif()
include(cmake/OpenCVPCHSupport.cmake)
......
......@@ -45,6 +45,16 @@ endif()
if(ITT_INCLUDE_DIRS)
ocv_module_include_directories(${ITT_INCLUDE_DIRS})
endif()
if(HAVE_POSIX_MEMALIGN)
ocv_append_sourge_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/alloc.cpp "HAVE_POSIX_MEMALIGN=1")
endif()
if(HAVE_MALLOC_H)
ocv_append_sourge_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/alloc.cpp "HAVE_MALLOC_H=1")
endif()
if(HAVE_MEMALIGN)
ocv_append_sourge_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/alloc.cpp "HAVE_MEMALIGN=1")
endif()
ocv_create_module(${extra_libs})
ocv_target_link_libraries(${the_module}
......
This diff is collapsed.
......@@ -148,10 +148,6 @@ BinaryFunc getCopyMaskFunc(size_t esz);
/* maximal average node_count/hash_size ratio beyond which hash table is resized */
#define CV_SPARSE_HASH_RATIO 3
#if defined _WIN32
void deleteThreadAllocData();
#endif
inline Size getContinuousSize_( int flags, int cols, int rows, int widthScale )
{
int64 sz = (int64)cols * rows * widthScale;
......
......@@ -1532,7 +1532,6 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpReserved)
{
// Not allowed to free resources if lpReserved is non-null
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583.aspx
cv::deleteThreadAllocData();
cv::getTlsStorage().releaseThread();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment