From 9b2fb8069869ec5cea32816a3589d9842595ffea Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 2 Dec 2024 14:26:11 +0100 Subject: reduce memory churn (#248) * eliminated allocation in SetCurrentThreadName * reduced memory allocator activity in cache RPC response building * reduced allocations in compact binary building --- src/zencore/thread.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/zencore/thread.cpp') diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp index 78afe924b..ab7e6857a 100644 --- a/src/zencore/thread.cpp +++ b/src/zencore/thread.cpp @@ -95,7 +95,10 @@ SetCurrentThreadName([[maybe_unused]] std::string_view ThreadName) if (SetThreadDescriptionFunc) { - SetThreadDescriptionFunc(::GetCurrentThread(), Utf8ToWide(ThreadName).c_str()); + WideStringBuilder<256> ThreadNameW; + Utf8ToWide(ThreadName, ThreadNameW); + + SetThreadDescriptionFunc(::GetCurrentThread(), ThreadNameW.c_str()); } // The debugger needs to be around to catch the name in the exception. If -- cgit v1.2.3