Skip to content

Commit 987683a

Browse files
authored
Keep string alive until nvtxDomainResourceCreate (#832)
Resolves #830 Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Bradley Dice (https://github.com/bdice) - Tianyu Liu (https://github.com/kingcrimsontianyu) URL: #832
1 parent b5b4232 commit 987683a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/src/nvtx.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ void NvtxManager::rename_current_thread(std::string_view new_name) noexcept
8585
attribs.identifierType = NVTX_RESOURCE_TYPE_GENERIC_THREAD_NATIVE;
8686
attribs.identifier.ullValue = tid;
8787
attribs.messageType = NVTX_MESSAGE_TYPE_ASCII;
88-
attribs.message.ascii = ss.str().c_str();
88+
auto st = ss.str();
89+
attribs.message.ascii = st.c_str();
8990
nvtxResourceHandle_t handle =
9091
nvtxDomainResourceCreate(nvtx3::domain::get<libkvikio_domain>(), &attribs);
9192
#endif

0 commit comments

Comments
 (0)