Skip to content

Commit

Permalink
Revert "fix: replace tbbmalloc with os native implementations"
Browse files Browse the repository at this point in the history
tbbmalloc is necessary on windows to get satisfactory performance in many cases #1537

This reverts commit 3816e08.
  • Loading branch information
Julusian committed May 24, 2024
1 parent ced9bcb commit d3af0b0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/CMakeModules/Bootstrap_Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ set(TBB_BIN_PATH "${SOURCE_DIR}/redist/intel64/vc14")
link_directories("${SOURCE_DIR}/lib/intel64/vc14")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb12.dll" "Release")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb12_debug.dll" "Debug")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc.dll" "Release")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_debug.dll" "Debug")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy.dll" "Release")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy_debug.dll" "Debug")

# GLEW
casparcg_add_external_project(glew)
Expand Down
3 changes: 2 additions & 1 deletion src/common/memshfl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <simde/x86/ssse3.h>
#else
#ifdef _MSC_VER
#include <tbb/scalable_allocator.h>
#include <intrin.h>
#else
#include <tmmintrin.h>
Expand All @@ -37,7 +38,7 @@ namespace caspar {
#ifdef _MSC_VER
static std::shared_ptr<void> create_aligned_buffer(size_t size)
{
return std::shared_ptr<void>(_aligned_malloc(size, 64), _aligned_free);
return std::shared_ptr<void>(scalable_aligned_malloc(size, 64), scalable_aligned_free);
}
#else
static std::shared_ptr<void> create_aligned_buffer(size_t size)
Expand Down
2 changes: 2 additions & 0 deletions src/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ if (MSVC)
Winmm.lib
Ws2_32.lib
optimized tbb.lib
optimized tbbmalloc.lib
debug tbb_debug.lib
debug tbbmalloc_debug.lib
OpenGL32.lib
glew32.lib
openal32.lib
Expand Down
7 changes: 7 additions & 0 deletions src/shell/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@
* Author: Robert Nagy, [email protected]
*/

// tbbmalloc_proxy:
// Replace the standard memory allocation routines in Microsoft* C/C++ RTL
// (malloc/free, global new/delete, etc.) with the TBB memory allocator
// as the default allocator suffers from low performance.

#if defined _DEBUG && defined _MSC_VER
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#include <stdlib.h>
#elif defined _MSC_VER
#include <tbb/tbbmalloc_proxy.h>
#endif

#include "included_modules.h"
Expand Down

0 comments on commit d3af0b0

Please sign in to comment.