From fcd69756c3f6236dcb14403de9b17f4ef3f6168c Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Wed, 26 Aug 2020 12:44:01 -0400 Subject: [PATCH] Fix memory leak getLastQueuedCommand(true) will implictly retain the last command, hence if we're not putting it in the waitlist, we should release it. Change-Id: I1ad4ddcdf1df5237b83e1ea2447eb39a59f7dc3a [ROCm/clr commit: 99980671748b9aa502431a17cedaf4e06426f7c6] --- projects/clr/hipamd/rocclr/hip_stream.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/clr/hipamd/rocclr/hip_stream.cpp b/projects/clr/hipamd/rocclr/hip_stream.cpp index 379954ef5c..565bb6d427 100755 --- a/projects/clr/hipamd/rocclr/hip_stream.cpp +++ b/projects/clr/hipamd/rocclr/hip_stream.cpp @@ -159,10 +159,13 @@ void iHipWaitActiveStreams(amd::HostQueue* blocking_queue, bool wait_null_stream (stream->Null() == wait_null_stream)) { // Get the last valid command amd::Command* command = active_queue->getLastQueuedCommand(true); - if ((command != nullptr) && - // Check the current active status - (command->status() != CL_COMPLETE)) { - eventWaitList.push_back(command); + if (command != nullptr) { + // Check the current active status + if (command->status() != CL_COMPLETE) { + eventWaitList.push_back(command); + } else { + command->release(); + } } } }