From e9860069be390bb18d6e309e37eb424befc8d9b4 Mon Sep 17 00:00:00 2001 From: Olga Andreeva Date: Tue, 18 Jul 2023 15:10:39 -0700 Subject: [PATCH] Revision 1 --- include/triton/core/tritonserver.h | 5 ++++- src/tritonserver.cc | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/triton/core/tritonserver.h b/include/triton/core/tritonserver.h index 748ab5ac1..c037242bb 100644 --- a/include/triton/core/tritonserver.h +++ b/include/triton/core/tritonserver.h @@ -879,7 +879,10 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_InferenceTraceRequestId( struct TRITONSERVER_InferenceTrace* trace, const char** request_id); -/// Get the child trace, spawned from the parent trace. +/// Get the child trace, spawned from the parent trace. The caller owns +/// the returned object and must call TRITONSERVER_InferenceTraceDelete +/// to release the object, unless ownership is transferred through +/// other APIs (see TRITONSERVER_ServerInferAsync). /// /// \param trace The trace. /// \param child_trace Returns the child trace, spawned from the trace. diff --git a/src/tritonserver.cc b/src/tritonserver.cc index 38bbbdb4b..c9fc49fc4 100644 --- a/src/tritonserver.cc +++ b/src/tritonserver.cc @@ -1067,8 +1067,12 @@ TRITONSERVER_InferenceTraceSpawnChildTrace( { #ifdef TRITON_ENABLE_TRACING tc::InferenceTrace* ltrace = reinterpret_cast(trace); - *child_trace = - reinterpret_cast(ltrace->SpawnChildTrace()); + if (trace != nullptr) { + *child_trace = reinterpret_cast( + ltrace->SpawnChildTrace()); + } else { + *child_trace = nullptr; + } return nullptr; // Success #else return TRITONSERVER_ErrorNew(