# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/jemalloc/hotfix-02-b68e762.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- From b68e7627d6c5e00055e31ee6846bea33844fccfe Mon Sep 17 00:00:00 2001 From: lexprfuncall <5360361+lexprfuncall@users.noreply.github.com> Date: Mon, 27 Apr 2026 11:00:22 -0700 Subject: [PATCH] Replace std::set_new_handler calls with std::get_new_handler Previously, std::set_new_handler was used as a workaround for compilers with only partial support for C++11. Now that C++14 is a requirement to enable C++ support, we can assume std::get_new_handler is available. --- src/jemalloc_cpp.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/jemalloc_cpp.cpp b/src/jemalloc_cpp.cpp index d1272879b0..ac109bb28e 100644 --- a/src/jemalloc_cpp.cpp +++ b/src/jemalloc_cpp.cpp @@ -1,5 +1,4 @@ #include -#include #include // NOLINTBEGIN(misc-use-anonymous-namespace) @@ -79,15 +78,7 @@ handleOOM(std::size_t size, bool nothrow) { void *ptr = nullptr; while (ptr == nullptr) { - std::new_handler handler; - // GCC-4.8 and clang 4.0 do not have std::get_new_handler. - { - static std::mutex mtx; - std::lock_guard lock(mtx); - - handler = std::set_new_handler(nullptr); - std::set_new_handler(handler); - } + std::new_handler handler = std::get_new_handler(); if (handler == nullptr) break;