From 1858eba4731934bbc29267b3f3ee60a52c24aeea Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Wed, 21 May 2025 19:10:57 +0200 Subject: [PATCH] Fix: Jemalloc settings not getting applied as version check fails Some Linux multi lib setups have a helper include file for Jemalloc that in turn includes the actual header file. This makes our version regex fail. As the Jemalloc version we are checking for is no longer in any of the currently supported LTS linux distros, we can safely drop it. Pull Request: https://projects.blender.org/blender/blender/pulls/139225 --- build_files/cmake/Modules/FindJeMalloc.cmake | 9 --------- intern/guardedalloc/CMakeLists.txt | 5 +---- intern/guardedalloc/intern/mallocn.cc | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/build_files/cmake/Modules/FindJeMalloc.cmake b/build_files/cmake/Modules/FindJeMalloc.cmake index afadf6c13a8..f69956e5ab4 100644 --- a/build_files/cmake/Modules/FindJeMalloc.cmake +++ b/build_files/cmake/Modules/FindJeMalloc.cmake @@ -47,15 +47,6 @@ find_library(JEMALLOC_LIBRARY lib64 lib ) -if(JEMALLOC_INCLUDE_DIR) - set(_version_regex "^#define[ \t]+JEMALLOC_VERSION[ \t]+\"([^\"]+)\".*") - file(STRINGS "${JEMALLOC_INCLUDE_DIR}/jemalloc.h" - JEMALLOC_VERSION REGEX "${_version_regex}") - string(REGEX REPLACE "${_version_regex}" "\\1" - JEMALLOC_VERSION "${JEMALLOC_VERSION}") - unset(_version_regex) -endif() - # handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt index 70af302d721..b41bbadc508 100644 --- a/intern/guardedalloc/CMakeLists.txt +++ b/intern/guardedalloc/CMakeLists.txt @@ -53,11 +53,8 @@ if(WIN32 AND NOT UNIX) endif() endif() -# Jemalloc 5.0.0+ needs extra configuration. if(WITH_MEM_JEMALLOC) - if(NOT ("${JEMALLOC_VERSION}" VERSION_LESS "5.0.0")) - add_definitions(-DWITH_JEMALLOC_CONF) - endif() + add_definitions(-DWITH_MEM_JEMALLOC) endif() blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/guardedalloc/intern/mallocn.cc b/intern/guardedalloc/intern/mallocn.cc index d09e908b918..d073a4e69d3 100644 --- a/intern/guardedalloc/intern/mallocn.cc +++ b/intern/guardedalloc/intern/mallocn.cc @@ -21,7 +21,7 @@ using namespace mem_guarded::internal; -#ifdef WITH_JEMALLOC_CONF +#ifdef WITH_MEM_JEMALLOC /** * If JEMALLOC is used, it reads this global variable and enables background * threads to purge dirty pages. Otherwise we release memory too slowly or not