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
This commit is contained in:
Sebastian Parborg
2025-05-21 19:10:57 +02:00
committed by Sebastian Parborg
parent 4397fa5056
commit 1858eba473
3 changed files with 2 additions and 14 deletions

View File

@@ -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)

View File

@@ -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}")

View File

@@ -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