From a9e829516af1cc75c70adc1abf2a007c7f5343e9 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Thu, 18 Sep 2025 18:12:11 +0000 Subject: [PATCH] Keep string alive until nvtxDomainResourceCreate --- cpp/src/nvtx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/src/nvtx.cpp b/cpp/src/nvtx.cpp index b9d7c3e146..0467e46e38 100644 --- a/cpp/src/nvtx.cpp +++ b/cpp/src/nvtx.cpp @@ -85,7 +85,8 @@ void NvtxManager::rename_current_thread(std::string_view new_name) noexcept attribs.identifierType = NVTX_RESOURCE_TYPE_GENERIC_THREAD_NATIVE; attribs.identifier.ullValue = tid; attribs.messageType = NVTX_MESSAGE_TYPE_ASCII; - attribs.message.ascii = ss.str().c_str(); + auto st = ss.str(); + attribs.message.ascii = st.c_str(); nvtxResourceHandle_t handle = nvtxDomainResourceCreate(nvtx3::domain::get(), &attribs); #endif